Skip to content

Commit a093e7e

Browse files
committed
Use SDPatternMatching and remove truncate...
Use SDPatternMatching and remove truncation. Also added 4xi64 case to reflect that.
1 parent 5f5f740 commit a093e7e

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "llvm/CodeGen/MachineJumpTableInfo.h"
2525
#include "llvm/CodeGen/MachineModuleInfo.h"
2626
#include "llvm/CodeGen/MachineRegisterInfo.h"
27+
#include "llvm/CodeGen/SDPatternMatch.h"
2728
#include "llvm/CodeGen/SelectionDAG.h"
2829
#include "llvm/CodeGen/SelectionDAGNodes.h"
2930
#include "llvm/IR/DiagnosticInfo.h"

llvm/test/CodeGen/WebAssembly/simd-setcc-reductions.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,26 @@ define i32 @all_true_2_i64(<2 x i64> %v) {
5757
%conv3 = zext i1 %3 to i32
5858
ret i32 %conv3
5959
}
60+
61+
62+
define i32 @all_true_4_i64(<4 x i64> %v) {
63+
; CHECK-LABEL: all_true_4_i64:
64+
; CHECK: .functype all_true_4_i64 (v128, v128) -> (i32)
65+
; CHECK-NEXT: # %bb.0:
66+
; CHECK-NEXT: v128.const $push9=, 0, 0
67+
; CHECK-NEXT: local.tee $push8=, $2=, $pop9
68+
; CHECK-NEXT: i64x2.eq $push1=, $0, $pop8
69+
; CHECK-NEXT: i64x2.eq $push0=, $1, $2
70+
; CHECK-NEXT: i8x16.shuffle $push2=, $pop1, $pop0, 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27
71+
; CHECK-NEXT: v128.any_true $push3=, $pop2
72+
; CHECK-NEXT: i32.const $push4=, -1
73+
; CHECK-NEXT: i32.xor $push5=, $pop3, $pop4
74+
; CHECK-NEXT: i32.const $push6=, 1
75+
; CHECK-NEXT: i32.and $push7=, $pop5, $pop6
76+
; CHECK-NEXT: return $pop7
77+
%1 = icmp eq <4 x i64> %v, zeroinitializer
78+
%2 = bitcast <4 x i1> %1 to i4
79+
%3 = icmp eq i4 %2, 0
80+
%conv3 = zext i1 %3 to i32
81+
ret i32 %conv3
82+
}

0 commit comments

Comments
 (0)