[llvm] r227972 - Improve test to actually check for a folded load.

Sanjay Patel spatel at rotateright.com
Tue Feb 3 07:37:18 PST 2015


Author: spatel
Date: Tue Feb  3 09:37:18 2015
New Revision: 227972

URL: http://llvm.org/viewvc/llvm-project?rev=227972&view=rev
Log:
Improve test to actually check for a folded load.

This test was checking for lack of a "movaps" (an aligned load)
rather than a "movups" (an unaligned load). It also included
a store which complicated the checking.

Add specific CPU runs to prevent subtarget feature flag overrides
from inhibiting this optimization.


Modified:
    llvm/trunk/test/CodeGen/X86/fold-vex.ll

Modified: llvm/trunk/test/CodeGen/X86/fold-vex.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-vex.ll?rev=227972&r1=227971&r2=227972&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fold-vex.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fold-vex.ll Tue Feb  3 09:37:18 2015
@@ -1,16 +1,20 @@
+; Use CPU parameters to ensure that a CPU-specific attribute is not overriding the AVX definition.
+
 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=corei7-avx | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=btver2 | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
+
+; No need to load unaligned operand from memory using an explicit instruction with AVX.
+; The operand should be folded into the AND instr.
 
-;CHECK: @test
-; No need to load from memory. The operand will be loaded as part of the AND instr.
-;CHECK-NOT: vmovaps
-;CHECK: vandps
-;CHECK: ret
+define <4 x i32> @test1(<4 x i32>* %p0, <4 x i32> %in1) nounwind {
+  %in0 = load <4 x i32>* %p0, align 2
+  %a = and <4 x i32> %in0, %in1
+  ret <4 x i32> %a
 
-define void @test1(<8 x i32>* %p0, <8 x i32> %in1) nounwind {
-entry:
-  %in0 = load <8 x i32>* %p0, align 2
-  %a = and <8 x i32> %in0, %in1
-  store <8 x i32> %a, <8 x i32>* undef
-  ret void
+; CHECK-LABEL: @test1
+; CHECK-NOT:   vmovups
+; CHECK:       vandps (%rdi), %xmm0, %xmm0
+; CHECK-NEXT:  ret
 }
 





More information about the llvm-commits mailing list