summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/WebAssembly/select.ll
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-02-23 18:59:01 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-02-23 18:59:01 +0000
commite661f946a7dba50cd8b77263f21707ecbc8f6794 (patch)
tree6210954ee2f315e98b796a132bd75e2841827380 /llvm/test/CodeGen/WebAssembly/select.ll
parentf383a47b7db24b6eeceeecfd4baed12efd138710 (diff)
downloadbcm5719-llvm-e661f946a7dba50cd8b77263f21707ecbc8f6794.tar.gz
bcm5719-llvm-e661f946a7dba50cd8b77263f21707ecbc8f6794.zip
[WebAssembly] Fix select of and (PR40805)
Fixes https://bugs.llvm.org/show_bug.cgi?id=40805 introduced by patterns added in D53676. I'm removing the patterns entirely here, as they are not correct in the general case. If necessary something more specific can be added in the future. Differential Revision: https://reviews.llvm.org/D58575 llvm-svn: 354733
Diffstat (limited to 'llvm/test/CodeGen/WebAssembly/select.ll')
-rw-r--r--llvm/test/CodeGen/WebAssembly/select.ll25
1 files changed, 21 insertions, 4 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/select.ll b/llvm/test/CodeGen/WebAssembly/select.ll
index daa934f4484..ef18d9183e5 100644
--- a/llvm/test/CodeGen/WebAssembly/select.ll
+++ b/llvm/test/CodeGen/WebAssembly/select.ll
@@ -17,8 +17,10 @@ define i32 @select_i32_bool(i1 zeroext %a, i32 %b, i32 %c) {
; CHECK-LABEL: select_i32_bool_nozext:
; CHECK-NEXT: .functype select_i32_bool_nozext (i32, i32, i32) -> (i32){{$}}
-; SLOW-NEXT: i32.select $push0=, $1, $2, $0{{$}}
-; SLOW-NEXT: return $pop0{{$}}
+; SLOW-NEXT: i32.const $push0=, 1{{$}}
+; SLOW-NEXT: i32.and $push1=, $0, $pop0{{$}}
+; SLOW-NEXT: i32.select $push2=, $1, $2, $pop1{{$}}
+; SLOW-NEXT: return $pop2{{$}}
define i32 @select_i32_bool_nozext(i1 %a, i32 %b, i32 %c) {
%cond = select i1 %a, i32 %b, i32 %c
ret i32 %cond
@@ -55,8 +57,10 @@ define i64 @select_i64_bool(i1 zeroext %a, i64 %b, i64 %c) {
; CHECK-LABEL: select_i64_bool_nozext:
; CHECK-NEXT: .functype select_i64_bool_nozext (i32, i64, i64) -> (i64){{$}}
-; SLOW-NEXT: i64.select $push0=, $1, $2, $0{{$}}
-; SLOW-NEXT: return $pop0{{$}}
+; SLOW-NEXT: i32.const $push0=, 1{{$}}
+; SLOW-NEXT: i32.and $push1=, $0, $pop0{{$}}
+; SLOW-NEXT: i64.select $push2=, $1, $2, $pop1{{$}}
+; SLOW-NEXT: return $pop2{{$}}
define i64 @select_i64_bool_nozext(i1 %a, i64 %b, i64 %c) {
%cond = select i1 %a, i64 %b, i64 %c
ret i64 %cond
@@ -157,3 +161,16 @@ define double @select_f64_ne(i32 %a, double %b, double %c) {
%cond = select i1 %cmp, double %b, double %c
ret double %cond
}
+
+; CHECK-LABEL: pr40805:
+; CHECK-NEXT: .functype pr40805 (i32, i32, i32) -> (i32){{$}}
+; SLOW-NEXT: i32.const $push0=, 1{{$}}
+; SLOW-NEXT: i32.and $push1=, $0, $pop0{{$}}
+; SLOW-NEXT: i32.select $push2=, $1, $2, $pop1{{$}}
+; SLOW-NEXT: return $pop2{{$}}
+define i32 @pr40805(i32 %x, i32 %y, i32 %z) {
+ %a = and i32 %x, 1
+ %b = icmp ne i32 %a, 0
+ %c = select i1 %b, i32 %y, i32 %z
+ ret i32 %c
+}
OpenPOWER on IntegriCloud