Existing ISel patterns match setne/seteq following SIMD boolean reductions any_true and all_true, and drop the ones that are redundant (because the reductions always return 1 or 0). This adds patterns to also produce eqz instructions instead of a comparison with a const.
28 lines
1011 B
LLVM
28 lines
1011 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: llc < %s -verify-machineinstrs -mattr=+simd128 | FileCheck %s
|
|
|
|
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20"
|
|
target triple = "wasm32"
|
|
|
|
declare void @llvm.memset.p0.i32(ptr writeonly, i8, i32, i1 immarg)
|
|
declare i32 @memcmp(ptr noundef, ptr noundef, i32 noundef)
|
|
|
|
define i1 @memcmp_zero(ptr %d) {
|
|
; CHECK-LABEL: memcmp_zero:
|
|
; CHECK: .functype memcmp_zero (i32) -> (i32)
|
|
; CHECK-NEXT: # %bb.0: # %entry
|
|
; CHECK-NEXT: local.get 0
|
|
; CHECK-NEXT: v128.const 0, 0
|
|
; CHECK-NEXT: v128.store 0:p2align=0
|
|
; CHECK-NEXT: i32.const 0
|
|
; CHECK-NEXT: v128.load 0:p2align=0
|
|
; CHECK-NEXT: v128.any_true
|
|
; CHECK-NEXT: i32.eqz
|
|
; CHECK-NEXT: # fallthrough-return
|
|
entry:
|
|
call void @llvm.memset.p0.i32(ptr %d, i8 0, i32 16, i1 false)
|
|
%call = call i32 @memcmp(ptr null, ptr %d, i32 16)
|
|
%tobool.not = icmp eq i32 %call, 0
|
|
ret i1 %tobool.not
|
|
}
|