1 ; RUN: llc < %s -asm-verbose=false | FileCheck %s 2 3 ; Test basic inline assembly. 4 5 target datalayout = "e-p:32:32-i64:64-n32:64-S128" 6 target triple = "wasm32-unknown-unknown" 7 8 ; CHECK-LABEL: foo: 9 ; CHECK-NEXT: .param i32{{$}} 10 ; CHECK-NEXT: .result i32{{$}} 11 ; CHECK-NEXT: #APP{{$}} 12 ; CHECK-NEXT: # $0 = aaa($0){{$}} 13 ; CHECK-NEXT: #NO_APP{{$}} 14 ; CHECK-NEXT: return $0{{$}} 15 define i32 @foo(i32 %r) { 16 entry: 17 %0 = tail call i32 asm sideeffect "# $0 = aaa($1)", "=r,r"(i32 %r) #0, !srcloc !0 18 ret i32 %0 19 } 20 21 ; CHECK-LABEL: bar: 22 ; CHECK-NEXT: .param i32, i32{{$}} 23 ; CHECK-NEXT: #APP{{$}} 24 ; CHECK-NEXT: # 0($1) = bbb(0($0)){{$}} 25 ; CHECK-NEXT: #NO_APP{{$}} 26 ; CHECK-NEXT: return{{$}} 27 define void @bar(i32* %r, i32* %s) { 28 entry: 29 tail call void asm sideeffect "# $0 = bbb($1)", "=*m,*m"(i32* %s, i32* %r) #0, !srcloc !1 30 ret void 31 } 32 33 ; CHECK-LABEL: imm: 34 ; CHECK-NEXT: .result i32{{$}} 35 ; CHECK-NEXT: .local i32{{$}} 36 ; CHECK-NEXT: #APP{{$}} 37 ; CHECK-NEXT: # $0 = ccc(42){{$}} 38 ; CHECK-NEXT: #NO_APP{{$}} 39 ; CHECK-NEXT: return $0{{$}} 40 define i32 @imm() { 41 entry: 42 %0 = tail call i32 asm sideeffect "# $0 = ccc($1)", "=r,i"(i32 42) #0, !srcloc !2 43 ret i32 %0 44 } 45 46 ; CHECK-LABEL: foo_i64: 47 ; CHECK-NEXT: .param i64{{$}} 48 ; CHECK-NEXT: .result i64{{$}} 49 ; CHECK-NEXT: #APP{{$}} 50 ; CHECK-NEXT: # $0 = aaa($0){{$}} 51 ; CHECK-NEXT: #NO_APP{{$}} 52 ; CHECK-NEXT: return $0{{$}} 53 define i64 @foo_i64(i64 %r) { 54 entry: 55 %0 = tail call i64 asm sideeffect "# $0 = aaa($1)", "=r,r"(i64 %r) #0, !srcloc !0 56 ret i64 %0 57 } 58 59 ; CHECK-LABEL: X_i16: 60 ; CHECK: foo $1{{$}} 61 ; CHECK: i32.store16 $discard=, 0($0), $1{{$}} 62 define void @X_i16(i16 * %t) { 63 call void asm sideeffect "foo $0", "=*X,~{dirflag},~{fpsr},~{flags},~{memory}"(i16* %t) 64 ret void 65 } 66 67 ; CHECK-LABEL: X_ptr: 68 ; CHECK: foo $1{{$}} 69 ; CHECK: i32.store $discard=, 0($0), $1{{$}} 70 define void @X_ptr(i16 ** %t) { 71 call void asm sideeffect "foo $0", "=*X,~{dirflag},~{fpsr},~{flags},~{memory}"(i16** %t) 72 ret void 73 } 74 75 ; CHECK-LABEL: funcname: 76 ; CHECK: foo funcname{{$}} 77 define void @funcname() { 78 tail call void asm sideeffect "foo $0", "i"(void ()* nonnull @funcname) #0, !srcloc !0 79 ret void 80 } 81 82 ; CHECK-LABEL: varname: 83 ; CHECK: foo gv+37{{$}} 84 @gv = global [0 x i8] zeroinitializer 85 define void @varname() { 86 tail call void asm sideeffect "foo $0", "i"(i8* getelementptr inbounds ([0 x i8], [0 x i8]* @gv, i64 0, i64 37)) #0, !srcloc !0 87 ret void 88 } 89 90 attributes #0 = { nounwind } 91 92 !0 = !{i32 47} 93 !1 = !{i32 145} 94 !2 = !{i32 231} 95