From: JF Bastien Date: Thu, 22 Oct 2015 02:32:50 +0000 (+0000) Subject: WebAssembly: fix more syntax X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=55a57a7674acbd7265598b11119d84af737de6d2;p=oota-llvm.git WebAssembly: fix more syntax br_if shouldn't start with a dot. div and rem went from prefix u/s to suffix. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250972 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp index f3e3170dad2..6b5f653f3b9 100644 --- a/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp +++ b/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp @@ -107,7 +107,7 @@ static std::string OpcodeName(const WebAssemblyInstrInfo *TII, std::string Name(&N[0], &N[NameEnd]); if (!HasType) return Name; - for (const char *typelessOpcode : { "return", "call" }) + for (const char *typelessOpcode : { "return", "call", "br_if" }) if (Name == typelessOpcode) return Name; return std::string(&N[NameEnd + 1], &N[Len]) + '.' + Name; diff --git a/lib/Target/WebAssembly/WebAssemblyInstrInteger.td b/lib/Target/WebAssembly/WebAssemblyInstrInteger.td index b62cdaeb393..6a28a13eb3b 100644 --- a/lib/Target/WebAssembly/WebAssemblyInstrInteger.td +++ b/lib/Target/WebAssembly/WebAssemblyInstrInteger.td @@ -15,10 +15,10 @@ defm ADD : BinaryInt; defm SUB : BinaryInt; defm MUL : BinaryInt; -defm SDIV : BinaryInt; -defm UDIV : BinaryInt; -defm SREM : BinaryInt; -defm UREM : BinaryInt; +defm DIV_S : BinaryInt; +defm DIV_U : BinaryInt; +defm REM_S : BinaryInt; +defm REM_U : BinaryInt; defm AND : BinaryInt; defm IOR : BinaryInt; defm XOR : BinaryInt; diff --git a/test/CodeGen/WebAssembly/i32.ll b/test/CodeGen/WebAssembly/i32.ll index 4eaa0e9c41d..8261d6cb6a1 100644 --- a/test/CodeGen/WebAssembly/i32.ll +++ b/test/CodeGen/WebAssembly/i32.ll @@ -69,7 +69,7 @@ define i32 @mul32(i32 %x, i32 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: sdiv (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: div_s (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i32 @sdiv32(i32 %x, i32 %y) { @@ -86,7 +86,7 @@ define i32 @sdiv32(i32 %x, i32 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: udiv (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: div_u (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i32 @udiv32(i32 %x, i32 %y) { @@ -103,7 +103,7 @@ define i32 @udiv32(i32 %x, i32 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: srem (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: rem_s (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i32 @srem32(i32 %x, i32 %y) { @@ -120,7 +120,7 @@ define i32 @srem32(i32 %x, i32 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: urem (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: rem_u (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i32 @urem32(i32 %x, i32 %y) { diff --git a/test/CodeGen/WebAssembly/i64.ll b/test/CodeGen/WebAssembly/i64.ll index 6223b037ddd..c112ed32426 100644 --- a/test/CodeGen/WebAssembly/i64.ll +++ b/test/CodeGen/WebAssembly/i64.ll @@ -69,7 +69,7 @@ define i64 @mul64(i64 %x, i64 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: sdiv (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: div_s (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i64 @sdiv64(i64 %x, i64 %y) { @@ -86,7 +86,7 @@ define i64 @sdiv64(i64 %x, i64 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: udiv (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: div_u (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i64 @udiv64(i64 %x, i64 %y) { @@ -103,7 +103,7 @@ define i64 @udiv64(i64 %x, i64 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: srem (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: rem_s (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i64 @srem64(i64 %x, i64 %y) { @@ -120,7 +120,7 @@ define i64 @srem64(i64 %x, i64 %y) { ; CHECK-NEXT: set_local 2, pop{{$}} ; CHECK-NEXT: get_local 0{{$}} ; CHECK-NEXT: set_local 3, pop{{$}} -; CHECK-NEXT: urem (get_local 3), (get_local 2){{$}} +; CHECK-NEXT: rem_u (get_local 3), (get_local 2){{$}} ; CHECK-NEXT: set_local 4, pop{{$}} ; CHECK-NEXT: return (get_local 4){{$}} define i64 @urem64(i64 %x, i64 %y) { diff --git a/test/CodeGen/WebAssembly/phi.ll b/test/CodeGen/WebAssembly/phi.ll index 107e87219f8..5ef2da350e3 100644 --- a/test/CodeGen/WebAssembly/phi.ll +++ b/test/CodeGen/WebAssembly/phi.ll @@ -10,7 +10,7 @@ target triple = "wasm32-unknown-unknown" ; CHECK-LABEL: test0: ; CHECK: get_local 0{{$}} ; CHECK: set_local [[REG:.*]], pop -; CHECK: sdiv (get_local [[REG]]), {{.*}} +; CHECK: div_s (get_local [[REG]]), {{.*}} ; CHECK: set_local [[REG]], pop ; CHECK: return (get_local [[REG]]) define i32 @test0(i32 %p) {