2 // compile-flags: -C target-feature=+avx2
4 #![feature(asm_const, asm_sym)]
12 // Bad register/register class
14 asm!("{}", in(foo) foo);
15 //~^ ERROR invalid register class `foo`: unknown register class
16 asm!("", in("foo") foo);
17 //~^ ERROR invalid register `foo`: unknown register
18 asm!("{:z}", in(reg) foo);
19 //~^ ERROR invalid asm template modifier for this register class
20 asm!("{:r}", in(xmm_reg) foo);
21 //~^ ERROR invalid asm template modifier for this register class
22 asm!("{:a}", const 0);
23 //~^ ERROR asm template modifiers are not allowed for `const` arguments
24 asm!("{:a}", sym main);
25 //~^ ERROR asm template modifiers are not allowed for `sym` arguments
26 asm!("", in("ebp") foo);
27 //~^ ERROR invalid register `ebp`: the frame pointer cannot be used as an operand
28 asm!("", in("rsp") foo);
29 //~^ ERROR invalid register `rsp`: the stack pointer cannot be used as an operand
30 asm!("", in("ip") foo);
31 //~^ ERROR invalid register `ip`: the instruction pointer cannot be used as an operand
33 asm!("", in("st(2)") foo);
34 //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output
35 //~| ERROR `i32` cannot be used with this register class
36 asm!("", in("mm0") foo);
37 //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output
38 //~| ERROR `i32` cannot be used with this register class
39 asm!("", in("k0") foo);
40 //~^ ERROR register class `kreg0` can only be used as a clobber, not as an input or output
41 //~| ERROR `i32` cannot be used with this register class
42 asm!("", out("st(2)") _);
43 asm!("", out("mm0") _);
44 asm!("{}", in(x87_reg) foo);
45 //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output
46 //~| ERROR `i32` cannot be used with this register class
47 asm!("{}", in(mmx_reg) foo);
48 //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output
49 //~| ERROR `i32` cannot be used with this register class
50 asm!("{}", out(x87_reg) _);
51 //~^ ERROR register class `x87_reg` can only be used as a clobber, not as an input or output
52 asm!("{}", out(mmx_reg) _);
53 //~^ ERROR register class `mmx_reg` can only be used as a clobber, not as an input or output
55 // Explicit register conflicts
56 // (except in/lateout which don't conflict)
58 asm!("", in("eax") foo, in("al") bar);
59 //~^ ERROR register `al` conflicts with register `ax`
60 //~| ERROR `i32` cannot be used with this register class
61 asm!("", in("rax") foo, out("rax") bar);
62 //~^ ERROR register `ax` conflicts with register `ax`
63 asm!("", in("al") foo, lateout("al") bar);
64 //~^ ERROR `i32` cannot be used with this register class
65 //~| ERROR `i32` cannot be used with this register class
66 asm!("", in("xmm0") foo, in("ymm0") bar);
67 //~^ ERROR register `ymm0` conflicts with register `xmm0`
68 asm!("", in("xmm0") foo, out("ymm0") bar);
69 //~^ ERROR register `ymm0` conflicts with register `xmm0`
70 asm!("", in("xmm0") foo, lateout("ymm0") bar);