diff options
| author | Thomas Lively <tlively@google.com> | 2019-01-14 22:03:43 +0000 |
|---|---|---|
| committer | Thomas Lively <tlively@google.com> | 2019-01-14 22:03:43 +0000 |
| commit | 2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6 (patch) | |
| tree | bfbcf03b9d8b4ccf47fbf3d809786bca04c273bf /llvm/test/CodeGen/WebAssembly/comparisons-i32.ll | |
| parent | f3857f33c33d19b447639a87e7f6a65d994aa417 (diff) | |
| download | bcm5719-llvm-2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6.tar.gz bcm5719-llvm-2a47e03ee4779b2b2c640c6ae3c0c91fef8c9fe6.zip | |
[WebAssembly][FastISel] Do not assume naive CmpInst lowering
Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=40172. See
test/CodeGen/WebAssembly/PR40172.ll for an explanation.
Reviewers: dschuff, aheejin
Subscribers: nikic, llvm-commits, sunfish, jgravelle-google, sbc100
Differential Revision: https://reviews.llvm.org/D56457
llvm-svn: 351127
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/comparisons-i32.ll')
| -rw-r--r-- | llvm/test/CodeGen/WebAssembly/comparisons-i32.ll | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/comparisons-i32.ll b/llvm/test/CodeGen/WebAssembly/comparisons-i32.ll index ce3215830e4..ed884e751b2 100644 --- a/llvm/test/CodeGen/WebAssembly/comparisons-i32.ll +++ b/llvm/test/CodeGen/WebAssembly/comparisons-i32.ll @@ -1,5 +1,5 @@ -; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s -; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -fast-isel -fast-isel-abort=1 | FileCheck %s +; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers | FileCheck %s --check-prefixes CHECK,SLOW +; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefixes CHECK,FAST ; Test that basic 32-bit integer comparison operations assemble as expected. @@ -10,8 +10,11 @@ target triple = "wasm32-unknown-unknown" ; CHECK-NEXT: .functype eq_i32 (i32, i32) -> (i32){{$}} ; CHECK-NEXT: local.get $push[[L0:[0-9]+]]=, 0{{$}} ; CHECK-NEXT: local.get $push[[L1:[0-9]+]]=, 1{{$}} -; CHECK-NEXT: i32.eq $push[[NUM:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK-NEXT: i32.eq $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; SLOW-NEXT: return $pop[[L2]]{{$}} +; FAST-NEXT: i32.const $push[[L3:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L4:[0-9]+]]=, $pop[[L2]], $pop[[L3]]{{$}} +; FAST-NEXT: return $pop[[L4]]{{$}} define i32 @eq_i32(i32 %x, i32 %y) { %a = icmp eq i32 %x, %y %b = zext i1 %a to i32 @@ -19,8 +22,11 @@ define i32 @eq_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ne_i32: -; CHECK: i32.ne $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.ne $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @ne_i32(i32 %x, i32 %y) { %a = icmp ne i32 %x, %y %b = zext i1 %a to i32 @@ -28,8 +34,11 @@ define i32 @ne_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: slt_i32: -; CHECK: i32.lt_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.lt_s $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @slt_i32(i32 %x, i32 %y) { %a = icmp slt i32 %x, %y %b = zext i1 %a to i32 @@ -37,8 +46,11 @@ define i32 @slt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sle_i32: -; CHECK: i32.le_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.le_s $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @sle_i32(i32 %x, i32 %y) { %a = icmp sle i32 %x, %y %b = zext i1 %a to i32 @@ -46,8 +58,11 @@ define i32 @sle_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ult_i32: -; CHECK: i32.lt_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.lt_u $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @ult_i32(i32 %x, i32 %y) { %a = icmp ult i32 %x, %y %b = zext i1 %a to i32 @@ -55,8 +70,11 @@ define i32 @ult_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ule_i32: -; CHECK: i32.le_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.le_u $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @ule_i32(i32 %x, i32 %y) { %a = icmp ule i32 %x, %y %b = zext i1 %a to i32 @@ -64,8 +82,11 @@ define i32 @ule_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sgt_i32: -; CHECK: i32.gt_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.gt_s $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @sgt_i32(i32 %x, i32 %y) { %a = icmp sgt i32 %x, %y %b = zext i1 %a to i32 @@ -73,8 +94,11 @@ define i32 @sgt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: sge_i32: -; CHECK: i32.ge_s $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.ge_s $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @sge_i32(i32 %x, i32 %y) { %a = icmp sge i32 %x, %y %b = zext i1 %a to i32 @@ -82,8 +106,11 @@ define i32 @sge_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: ugt_i32: -; CHECK: i32.gt_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.gt_u $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @ugt_i32(i32 %x, i32 %y) { %a = icmp ugt i32 %x, %y %b = zext i1 %a to i32 @@ -91,8 +118,11 @@ define i32 @ugt_i32(i32 %x, i32 %y) { } ; CHECK-LABEL: uge_i32: -; CHECK: i32.ge_u $push[[NUM:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} -; CHECK-NEXT: return $pop[[NUM]]{{$}} +; CHECK: i32.ge_u $push[[L0:[0-9]+]]=, $pop{{[0-9]+}}, $pop{{[0-9]+}}{{$}} +; SLOW-NEXT: return $pop[[L0]]{{$}} +; FAST-NEXT: i32.const $push[[L1:[0-9]+]]=, 1{{$}} +; FAST-NEXT: i32.and $push[[L2:[0-9]+]]=, $pop[[L0]], $pop[[L1]]{{$}} +; FAST-NEXT: return $pop[[L2]]{{$}} define i32 @uge_i32(i32 %x, i32 %y) { %a = icmp uge i32 %x, %y %b = zext i1 %a to i32 |

