7b232026ec1008a358727a384124065896054509
[oota-llvm.git] / test / CodeGen / X86 / avx1-stack-reload-folding.ll
1 ; RUN: llc -O3 -disable-peephole -mcpu=corei7-avx -mattr=+avx < %s | FileCheck %s\r
2 \r
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"\r
4 target triple = "x86_64-unknown-unknown"\r
5 \r
6 ; Stack reload folding tests - we use the 'big vectors' pattern to guarantee spilling to stack.\r
7 ;\r
8 ; Many of these tests are primarily to check memory folding with specific instructions. Using a basic\r
9 ; load/cvt/store pattern to test for this would mean that it wouldn't be the memory folding code thats\r
10 ; being tested - the load-execute version of the instruction from the tables would be matched instead.\r
11 \r
12 define void @stack_fold_vmulpd(<64 x double>* %a, <64 x double>* %b, <64 x double>* %c) {\r
13   ;CHECK:       vmulpd {{[0-9]*}}(%rsp), {{%ymm[0-9][0-9]*}}, {{%ymm[0-9][0-9]*}} {{.*#+}} 32-byte Folded Reload\r
14   %1 = load <64 x double>* %a\r
15   %2 = load <64 x double>* %b\r
16   %3 = fadd <64 x double> %1, %2\r
17   %4 = fsub <64 x double> %1, %2\r
18   %5 = fmul <64 x double> %3, %4\r
19   store <64 x double> %5, <64 x double>* %c\r
20   ret void\r
21 }\r
22 \r
23 define void @stack_fold_cvtdq2ps(<128 x i32>* %a, <128 x i32>* %b, <128 x float>* %c) {\r
24   ;CHECK:   vcvtdq2ps {{[0-9]*}}(%rsp), {{%ymm[0-9][0-9]*}} {{.*#+}} 32-byte Folded Reload\r
25   %1 = load <128 x i32>* %a\r
26   %2 = load <128 x i32>* %b\r
27   %3 = and <128 x i32> %1, %2\r
28   %4 = xor <128 x i32> %1, %2\r
29   %5 = sitofp <128 x i32> %3 to <128 x float>\r
30   %6 = sitofp <128 x i32> %4 to <128 x float>\r
31   %7 = fadd <128 x float> %5, %6\r
32   store <128 x float> %7, <128 x float>* %c\r
33   ret void\r
34 }\r