diff --git a/lib/Target/WebAssembly/WebAssemblyInstrCall.td b/lib/Target/WebAssembly/WebAssemblyInstrCall.td index 6ea8cec7397..e9cad01f9df 100644 --- a/lib/Target/WebAssembly/WebAssemblyInstrCall.td +++ b/lib/Target/WebAssembly/WebAssemblyInstrCall.td @@ -25,19 +25,19 @@ def ADJCALLSTACKUP : I<(outs), (ins i32imm:$amt), [(WebAssemblycallseq_end timm:$amt, undef)]>; } // isCodeGenOnly = 1 -multiclass CALL { +multiclass CALL { def CALL_#vt : I<(outs vt:$dst), (ins i32imm:$callee, variable_ops), [(set vt:$dst, (WebAssemblycall1 (i32 imm:$callee)))], - "call \t$dst, $callee">; + !strconcat(prefix, "call\t$dst, $callee")>; def CALL_INDIRECT_#vt : I<(outs vt:$dst), (ins I32:$callee, variable_ops), [(set vt:$dst, (WebAssemblycall1 I32:$callee))], - "call_indirect\t$dst, $callee">; + !strconcat(prefix, "call_indirect\t$dst, $callee")>; } let Uses = [SP32, SP64], isCall = 1 in { - defm : CALL; - defm : CALL; - defm : CALL; - defm : CALL; + defm : CALL; + defm : CALL; + defm : CALL; + defm : CALL; def CALL_VOID : I<(outs), (ins i32imm:$callee, variable_ops), [(WebAssemblycall0 (i32 imm:$callee))], diff --git a/test/CodeGen/WebAssembly/call.ll b/test/CodeGen/WebAssembly/call.ll index d4b64356546..9158ccec097 100644 --- a/test/CodeGen/WebAssembly/call.ll +++ b/test/CodeGen/WebAssembly/call.ll @@ -15,7 +15,7 @@ declare void @void_nullary() ; CHECK-LABEL: call_i32_nullary: ; CHECK-NEXT: .result i32{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, i32_nullary{{$}} +; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_nullary{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define i32 @call_i32_nullary() { %r = call i32 @i32_nullary() @@ -24,7 +24,7 @@ define i32 @call_i32_nullary() { ; CHECK-LABEL: call_i64_nullary: ; CHECK-NEXT: .result i64{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, i64_nullary{{$}} +; CHECK-NEXT: {{^}} i64.call $push[[NUM:[0-9]+]]=, i64_nullary{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define i64 @call_i64_nullary() { %r = call i64 @i64_nullary() @@ -33,7 +33,7 @@ define i64 @call_i64_nullary() { ; CHECK-LABEL: call_float_nullary: ; CHECK-NEXT: .result f32{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, float_nullary{{$}} +; CHECK-NEXT: {{^}} f32.call $push[[NUM:[0-9]+]]=, float_nullary{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define float @call_float_nullary() { %r = call float @float_nullary() @@ -42,7 +42,7 @@ define float @call_float_nullary() { ; CHECK-LABEL: call_double_nullary: ; CHECK-NEXT: .result f64{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, double_nullary{{$}} +; CHECK-NEXT: {{^}} f64.call $push[[NUM:[0-9]+]]=, double_nullary{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define double @call_double_nullary() { %r = call double @double_nullary() @@ -50,7 +50,7 @@ define double @call_double_nullary() { } ; CHECK-LABEL: call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: {{^}} call void_nullary{{$}} ; CHECK-NEXT: return{{$}} define void @call_void_nullary() { call void @void_nullary() @@ -60,7 +60,7 @@ define void @call_void_nullary() { ; CHECK-LABEL: call_i32_unary: ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, i32_unary, $0{{$}} +; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_unary, $0{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define i32 @call_i32_unary(i32 %a) { %r = call i32 @i32_unary(i32 %a) @@ -70,7 +70,7 @@ define i32 @call_i32_unary(i32 %a) { ; CHECK-LABEL: call_i32_binary: ; CHECK-NEXT: .param i32, i32{{$}} ; CHECK-NEXT: .result i32{{$}} -; CHECK-NEXT: call $push[[NUM:[0-9]+]]=, i32_binary, $0, $1{{$}} +; CHECK-NEXT: {{^}} i32.call $push[[NUM:[0-9]+]]=, i32_binary, $0, $1{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define i32 @call_i32_binary(i32 %a, i32 %b) { %r = call i32 @i32_binary(i32 %a, i32 %b) @@ -79,7 +79,7 @@ define i32 @call_i32_binary(i32 %a, i32 %b) { ; CHECK-LABEL: call_indirect_void: ; CHECK-NEXT: .param i32{{$}} -; CHECK-NEXT: call_indirect $0{{$}} +; CHECK-NEXT: {{^}} call_indirect $0{{$}} ; CHECK-NEXT: return{{$}} define void @call_indirect_void(void ()* %callee) { call void %callee() @@ -89,7 +89,7 @@ define void @call_indirect_void(void ()* %callee) { ; CHECK-LABEL: call_indirect_i32: ; CHECK-NEXT: .param i32{{$}} ; CHECK-NEXT: .result i32{{$}} -; CHECK-NEXT: call_indirect $push[[NUM:[0-9]+]]=, $0{{$}} +; CHECK-NEXT: {{^}} i32.call_indirect $push[[NUM:[0-9]+]]=, $0{{$}} ; CHECK-NEXT: return $pop[[NUM]]{{$}} define i32 @call_indirect_i32(i32 ()* %callee) { %t = call i32 %callee() @@ -97,7 +97,7 @@ define i32 @call_indirect_i32(i32 ()* %callee) { } ; CHECK-LABEL: tail_call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: {{^}} call void_nullary{{$}} ; CHECK-NEXT: return{{$}} define void @tail_call_void_nullary() { tail call void @void_nullary() @@ -105,7 +105,7 @@ define void @tail_call_void_nullary() { } ; CHECK-LABEL: fastcc_tail_call_void_nullary: -; CHECK-NEXT: call void_nullary{{$}} +; CHECK-NEXT: {{^}} call void_nullary{{$}} ; CHECK-NEXT: return{{$}} define void @fastcc_tail_call_void_nullary() { tail call fastcc void @void_nullary() @@ -113,7 +113,7 @@ define void @fastcc_tail_call_void_nullary() { } ; CHECK-LABEL: coldcc_tail_call_void_nullary: -; CHECK-NEXT: call void_nullary +; CHECK-NEXT: {{^}} call void_nullary ; CHECK-NEXT: return{{$}} define void @coldcc_tail_call_void_nullary() { tail call coldcc void @void_nullary() diff --git a/test/CodeGen/WebAssembly/f32.ll b/test/CodeGen/WebAssembly/f32.ll index 10fe1856037..777010064cd 100644 --- a/test/CodeGen/WebAssembly/f32.ll +++ b/test/CodeGen/WebAssembly/f32.ll @@ -146,7 +146,7 @@ define float @fmax32(float %x) { } ; CHECK-LABEL: fma32: -; CHECK: call $push0=, fmaf, $0, $1, $2{{$}} +; CHECK: {{^}} f32.call $push0=, fmaf, $0, $1, $2{{$}} ; CHECK-NEXT: return $pop0{{$}} define float @fma32(float %a, float %b, float %c) { %d = call float @llvm.fma.f32(float %a, float %b, float %c) diff --git a/test/CodeGen/WebAssembly/f64.ll b/test/CodeGen/WebAssembly/f64.ll index 51eb33790a9..302ee79389b 100644 --- a/test/CodeGen/WebAssembly/f64.ll +++ b/test/CodeGen/WebAssembly/f64.ll @@ -146,7 +146,7 @@ define double @fmax64(double %x) { } ; CHECK-LABEL: fma64: -; CHECK: call $push0=, fma, $0, $1, $2{{$}} +; CHECK: {{^}} f64.call $push0=, fma, $0, $1, $2{{$}} ; CHECK-NEXT: return $pop0{{$}} define double @fma64(double %a, double %b, double %c) { %d = call double @llvm.fma.f64(double %a, double %b, double %c) diff --git a/test/CodeGen/WebAssembly/frem.ll b/test/CodeGen/WebAssembly/frem.ll index 43552a9bdf3..688370313b4 100644 --- a/test/CodeGen/WebAssembly/frem.ll +++ b/test/CodeGen/WebAssembly/frem.ll @@ -8,7 +8,7 @@ target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: frem32: ; CHECK-NEXT: .param f32, f32{{$}} ; CHECK-NEXT: .result f32{{$}} -; CHECK-NEXT: call $push0=, fmodf, $0, $1{{$}} +; CHECK-NEXT: {{^}} f32.call $push0=, fmodf, $0, $1{{$}} ; CHECK-NEXT: return $pop0{{$}} define float @frem32(float %x, float %y) { %a = frem float %x, %y @@ -18,7 +18,7 @@ define float @frem32(float %x, float %y) { ; CHECK-LABEL: frem64: ; CHECK-NEXT: .param f64, f64{{$}} ; CHECK-NEXT: .result f64{{$}} -; CHECK-NEXT: call $push0=, fmod, $0, $1{{$}} +; CHECK-NEXT: {{^}} f64.call $push0=, fmod, $0, $1{{$}} ; CHECK-NEXT: return $pop0{{$}} define double @frem64(double %x, double %y) { %a = frem double %x, %y diff --git a/test/CodeGen/WebAssembly/returned.ll b/test/CodeGen/WebAssembly/returned.ll index 9cfdc711a8a..e208e198c73 100644 --- a/test/CodeGen/WebAssembly/returned.ll +++ b/test/CodeGen/WebAssembly/returned.ll @@ -8,8 +8,8 @@ target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: _Z3foov: ; CHECK-NEXT: .result i32{{$}} ; CHECK-NEXT: i32.const $push0=, 1{{$}} -; CHECK-NEXT: call $push1=, _Znwm, $pop0{{$}} -; CHECK-NEXT: call $push2=, _ZN5AppleC1Ev, $pop1{{$}} +; CHECK-NEXT: {{^}} i32.call $push1=, _Znwm, $pop0{{$}} +; CHECK-NEXT: {{^}} i32.call $push2=, _ZN5AppleC1Ev, $pop1{{$}} ; CHECK-NEXT: return $pop2{{$}} %class.Apple = type { i8 } declare noalias i8* @_Znwm(i32) @@ -25,7 +25,7 @@ entry: ; CHECK-LABEL: _Z3barPvS_l: ; CHECK-NEXT: .param i32, i32, i32{{$}} ; CHECK-NEXT: .result i32{{$}} -; CHECK-NEXT: call $push0=, memcpy, $0, $1, $2{{$}} +; CHECK-NEXT: {{^}} i32.call $push0=, memcpy, $0, $1, $2{{$}} ; CHECK-NEXT: return $pop0{{$}} declare i8* @memcpy(i8* returned, i8*, i32) define i8* @_Z3barPvS_l(i8* %p, i8* %s, i32 %n) { @@ -38,7 +38,7 @@ entry: ; CHECK-LABEL: test_constant_arg: ; CHECK-NEXT: i32.const $push0=, global{{$}} -; CHECK-NEXT: call $discard=, returns_arg, $pop0{{$}} +; CHECK-NEXT: {{^}} i32.call $discard=, returns_arg, $pop0{{$}} ; CHECK-NEXT: return{{$}} @global = external global i32 @addr = global i32* @global diff --git a/test/CodeGen/WebAssembly/unused-argument.ll b/test/CodeGen/WebAssembly/unused-argument.ll index 5eec827216e..e7851b216cb 100644 --- a/test/CodeGen/WebAssembly/unused-argument.ll +++ b/test/CodeGen/WebAssembly/unused-argument.ll @@ -22,7 +22,7 @@ define i32 @unused_second(i32 %x, i32 %y) { } ; CHECK-LABEL: call_something: -; CHECK-NEXT: call $discard=, return_something{{$}} +; CHECK-NEXT: {{^}} i32.call $discard=, return_something{{$}} ; CHECK-NEXT: return{{$}} declare i32 @return_something() define void @call_something() {