xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/inline-asm.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -no-integrated-as
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdefine i32 @test1() nounwind {
4*9880d681SAndroid Build Coastguard Worker	; Dest is AX, dest type = i32.
5*9880d681SAndroid Build Coastguard Worker        %tmp4 = call i32 asm sideeffect "FROB $0", "={ax}"()
6*9880d681SAndroid Build Coastguard Worker        ret i32 %tmp4
7*9880d681SAndroid Build Coastguard Worker}
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine void @test2(i32 %V) nounwind {
10*9880d681SAndroid Build Coastguard Worker	; input is AX, in type = i32.
11*9880d681SAndroid Build Coastguard Worker        call void asm sideeffect "FROB $0", "{ax}"(i32 %V)
12*9880d681SAndroid Build Coastguard Worker        ret void
13*9880d681SAndroid Build Coastguard Worker}
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine void @test3() nounwind {
16*9880d681SAndroid Build Coastguard Worker        ; FP constant as a memory operand.
17*9880d681SAndroid Build Coastguard Worker        tail call void asm sideeffect "frob $0", "m"( float 0x41E0000000000000)
18*9880d681SAndroid Build Coastguard Worker        ret void
19*9880d681SAndroid Build Coastguard Worker}
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerdefine void @test4() nounwind {
22*9880d681SAndroid Build Coastguard Worker       ; J means a constant in range 0 to 63.
23*9880d681SAndroid Build Coastguard Worker       tail call void asm sideeffect "bork $0", "J"(i32 37) nounwind
24*9880d681SAndroid Build Coastguard Worker       ret void
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Worker; rdar://9738585
28*9880d681SAndroid Build Coastguard Workerdefine i32 @test5() nounwind {
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker  %0 = tail call i32 asm "test", "=l,~{dirflag},~{fpsr},~{flags}"() nounwind
31*9880d681SAndroid Build Coastguard Worker  ret i32 0
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; rdar://9777108 PR10352
35*9880d681SAndroid Build Coastguard Workerdefine void @test6(i1 zeroext %desired) nounwind {
36*9880d681SAndroid Build Coastguard Workerentry:
37*9880d681SAndroid Build Coastguard Worker  tail call void asm sideeffect "foo $0", "q,~{dirflag},~{fpsr},~{flags}"(i1 %desired) nounwind
38*9880d681SAndroid Build Coastguard Worker  ret void
39*9880d681SAndroid Build Coastguard Worker}
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Workerdefine void @test7(i1 zeroext %desired, i32* %p) nounwind {
42*9880d681SAndroid Build Coastguard Workerentry:
43*9880d681SAndroid Build Coastguard Worker  %0 = tail call i8 asm sideeffect "xchg $0, $1", "=r,*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %p, i1 %desired) nounwind
44*9880d681SAndroid Build Coastguard Worker  ret void
45*9880d681SAndroid Build Coastguard Worker}
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker; <rdar://problem/11542429>
48*9880d681SAndroid Build Coastguard Worker; The constrained GR32_ABCD register class of the 'q' constraint requires
49*9880d681SAndroid Build Coastguard Worker; special handling after the preceding outputs used up eax-edx.
50*9880d681SAndroid Build Coastguard Workerdefine void @constrain_abcd(i8* %h) nounwind ssp {
51*9880d681SAndroid Build Coastguard Workerentry:
52*9880d681SAndroid Build Coastguard Worker  %0 = call { i32, i32, i32, i32, i32 } asm sideeffect "", "=&r,=&r,=&r,=&r,=&q,r,~{ecx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %h) nounwind
53*9880d681SAndroid Build Coastguard Worker  ret void
54*9880d681SAndroid Build Coastguard Worker}
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Worker; Mix normal and EC defs of the same register.
57*9880d681SAndroid Build Coastguard Workerdefine i32 @pr14376() nounwind noinline {
58*9880d681SAndroid Build Coastguard Workerentry:
59*9880d681SAndroid Build Coastguard Worker  %asm = tail call i32 asm sideeffect "", "={ax},i,~{eax},~{flags},~{rax}"(i64 61) nounwind
60*9880d681SAndroid Build Coastguard Worker  ret i32 %asm
61*9880d681SAndroid Build Coastguard Worker}
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker@test8_v = global i32 42
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Workerdefine void @test8() {
66*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "${0:P}", "i"( i32* @test8_v )
67*9880d681SAndroid Build Coastguard Worker  ret void
68*9880d681SAndroid Build Coastguard Worker}
69*9880d681SAndroid Build Coastguard Worker
70*9880d681SAndroid Build Coastguard Workerdefine void @test9() {
71*9880d681SAndroid Build Coastguard Worker  call void asm sideeffect "${0:P}", "X"( i8* blockaddress(@test9, %bb) )
72*9880d681SAndroid Build Coastguard Worker  br label %bb
73*9880d681SAndroid Build Coastguard Worker
74*9880d681SAndroid Build Coastguard Workerbb:
75*9880d681SAndroid Build Coastguard Worker  ret void
76*9880d681SAndroid Build Coastguard Worker}
77