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;
defm ADD : BinaryInt<add>;
defm SUB : BinaryInt<sub>;
defm MUL : BinaryInt<mul>;
-defm SDIV : BinaryInt<sdiv>;
-defm UDIV : BinaryInt<udiv>;
-defm SREM : BinaryInt<srem>;
-defm UREM : BinaryInt<urem>;
+defm DIV_S : BinaryInt<sdiv>;
+defm DIV_U : BinaryInt<udiv>;
+defm REM_S : BinaryInt<srem>;
+defm REM_U : BinaryInt<urem>;
defm AND : BinaryInt<and>;
defm IOR : BinaryInt<or>;
defm XOR : BinaryInt<xor>;
; 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) {
; 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) {
; 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) {
; 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) {
; 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) {
; 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) {
; 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) {
; 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) {
; 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) {