diff options
author | Jim Grosbach <grosbach@apple.com> | 2014-07-23 20:41:43 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2014-07-23 20:41:43 +0000 |
commit | 724e438c62794ce56380a154b99c5d123f484271 (patch) | |
tree | 9cb3bc0f6d6a7539d77511002c5a23a56b95caf9 /llvm/test | |
parent | 8f6f0858ec4db02dd115fc52b0c04d4c68cb9434 (diff) | |
download | bcm5719-llvm-724e438c62794ce56380a154b99c5d123f484271.tar.gz bcm5719-llvm-724e438c62794ce56380a154b99c5d123f484271.zip |
[X86,AArch64] Extend vcmp w/ unary op combine to work w/ more constants.
The transform to constant fold unary operations with an AND across a
vector comparison applies when the constant is not a splat of a scalar
as well.
llvm-svn: 213800
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/CodeGen/AArch64/arm64-setcc-int-to-fp-combine.ll | 20 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll | 18 |
2 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/arm64-setcc-int-to-fp-combine.ll b/llvm/test/CodeGen/AArch64/arm64-setcc-int-to-fp-combine.ll index 045c9cd9aeb..74ca61f57d7 100644 --- a/llvm/test/CodeGen/AArch64/arm64-setcc-int-to-fp-combine.ll +++ b/llvm/test/CodeGen/AArch64/arm64-setcc-int-to-fp-combine.ll @@ -25,3 +25,23 @@ define void @foo1(<4 x float> %val, <4 x float> %test, <4 x double>* %p) nounwin store <4 x double> %result, <4 x double>* %p ret void } + +; Fold explicit AND operations when the constant isn't a splat of a single +; scalar value like what the zext creates. +define <4 x float> @foo2(<4 x float> %val, <4 x float> %test) nounwind { +; CHECK-LABEL: lCPI2_0: +; CHECK-NEXT: .long 1065353216 +; CHECK-NEXT: .long 0 +; CHECK-NEXT: .long 1065353216 +; CHECK-NEXT: .long 0 +; CHECK-LABEL: foo2: +; CHECK: adrp x8, lCPI2_0@PAGE +; CHECK: ldr q2, [x8, lCPI2_0@PAGEOFF] +; CHECK-NEXT: fcmeq.4s v0, v0, v1 +; CHECK-NEXT: and.16b v0, v0, v2 + %cmp = fcmp oeq <4 x float> %val, %test + %ext = zext <4 x i1> %cmp to <4 x i32> + %and = and <4 x i32> %ext, <i32 255, i32 256, i32 257, i32 258> + %result = sitofp <4 x i32> %and to <4 x float> + ret <4 x float> %result +} diff --git a/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll b/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll index f737519bd15..4fe6c664df5 100644 --- a/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll +++ b/llvm/test/CodeGen/X86/x86-setcc-int-to-fp-combine.ll @@ -54,3 +54,21 @@ define void @foo2(<4 x float>* noalias %result) nounwind { store <4 x float> %val, <4 x float>* %result ret void } + +; Fold explicit AND operations when the constant isn't a splat of a single +; scalar value like what the zext creates. +define <4 x float> @foo3(<4 x float> %val, <4 x float> %test) nounwind { +; CHECK-LABEL: LCPI3_0: +; CHECK-NEXT: .long 1065353216 ## float 1.000000e+00 +; CHECK-NEXT: .long 0 ## float 0.000000e+00 +; CHECK-NEXT: .long 1065353216 ## float 1.000000e+00 +; CHECK-NEXT: .long 0 ## float 0.000000e+00 +; CHECK-LABEL: foo3: +; CHECK: cmpeqps %xmm1, %xmm0 +; CHECK-NEXT: andps LCPI3_0(%rip), %xmm0 + %cmp = fcmp oeq <4 x float> %val, %test + %ext = zext <4 x i1> %cmp to <4 x i32> + %and = and <4 x i32> %ext, <i32 255, i32 256, i32 257, i32 258> + %result = sitofp <4 x i32> %and to <4 x float> + ret <4 x float> %result +} |