xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/sse-domains.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mcpu=nehalem | FileCheck %s
2*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-macosx10.7"
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker; CHECK: f
6*9880d681SAndroid Build Coastguard Worker;
7*9880d681SAndroid Build Coastguard Worker; This function contains load / store / and operations that all can execute in
8*9880d681SAndroid Build Coastguard Worker; any domain.  The only domain-specific operation is the %add = shl... operation
9*9880d681SAndroid Build Coastguard Worker; which is <4 x i32>.
10*9880d681SAndroid Build Coastguard Worker;
11*9880d681SAndroid Build Coastguard Worker; The paddd instruction can only influence the other operations through the loop
12*9880d681SAndroid Build Coastguard Worker; back-edge. Check that everything is still moved into the integer domain.
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine void @f(<4 x i32>* nocapture %p, i32 %n) nounwind uwtable ssp {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker  br label %while.body
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; Materialize a zeroinitializer and a constant-pool load in the integer domain.
19*9880d681SAndroid Build Coastguard Worker; The order is not important.
20*9880d681SAndroid Build Coastguard Worker; CHECK: pxor
21*9880d681SAndroid Build Coastguard Worker; CHECK: movdqa
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; The instructions in the loop must all be integer domain as well.
24*9880d681SAndroid Build Coastguard Worker; CHECK: while.body
25*9880d681SAndroid Build Coastguard Worker; CHECK: pand
26*9880d681SAndroid Build Coastguard Worker; CHECK: movdqa
27*9880d681SAndroid Build Coastguard Worker; CHECK: movdqa
28*9880d681SAndroid Build Coastguard Worker; Finally, the controlling integer-only instruction.
29*9880d681SAndroid Build Coastguard Worker; CHECK: paddd
30*9880d681SAndroid Build Coastguard Workerwhile.body:
31*9880d681SAndroid Build Coastguard Worker  %p.addr.04 = phi <4 x i32>* [ %incdec.ptr, %while.body ], [ %p, %entry ]
32*9880d681SAndroid Build Coastguard Worker  %n.addr.03 = phi i32 [ %dec, %while.body ], [ %n, %entry ]
33*9880d681SAndroid Build Coastguard Worker  %x.02 = phi <4 x i32> [ %add, %while.body ], [ zeroinitializer, %entry ]
34*9880d681SAndroid Build Coastguard Worker  %dec = add nsw i32 %n.addr.03, -1
35*9880d681SAndroid Build Coastguard Worker  %and = and <4 x i32> %x.02, <i32 127, i32 127, i32 127, i32 127>
36*9880d681SAndroid Build Coastguard Worker  %incdec.ptr = getelementptr inbounds <4 x i32>, <4 x i32>* %p.addr.04, i64 1
37*9880d681SAndroid Build Coastguard Worker  store <4 x i32> %and, <4 x i32>* %p.addr.04, align 16
38*9880d681SAndroid Build Coastguard Worker  %0 = load <4 x i32>, <4 x i32>* %incdec.ptr, align 16
39*9880d681SAndroid Build Coastguard Worker  %add = shl <4 x i32> %0, <i32 1, i32 1, i32 1, i32 1>
40*9880d681SAndroid Build Coastguard Worker  %tobool = icmp eq i32 %dec, 0
41*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %while.end, label %while.body
42*9880d681SAndroid Build Coastguard Worker
43*9880d681SAndroid Build Coastguard Workerwhile.end:
44*9880d681SAndroid Build Coastguard Worker  ret void
45*9880d681SAndroid Build Coastguard Worker}
46