xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/vec_zero.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -march=x86 -mattr=+sse2 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; CHECK: foo
4*9880d681SAndroid Build Coastguard Worker; CHECK: xorps
5*9880d681SAndroid Build Coastguard Workerdefine void @foo(<4 x float>* %P) {
6*9880d681SAndroid Build Coastguard Worker        %T = load <4 x float>, <4 x float>* %P               ; <<4 x float>> [#uses=1]
7*9880d681SAndroid Build Coastguard Worker        %S = fadd <4 x float> zeroinitializer, %T                ; <<4 x float>> [#uses=1]
8*9880d681SAndroid Build Coastguard Worker        store <4 x float> %S, <4 x float>* %P
9*9880d681SAndroid Build Coastguard Worker        ret void
10*9880d681SAndroid Build Coastguard Worker}
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker; CHECK: bar
13*9880d681SAndroid Build Coastguard Worker; CHECK: pxor
14*9880d681SAndroid Build Coastguard Workerdefine void @bar(<4 x i32>* %P) {
15*9880d681SAndroid Build Coastguard Worker        %T = load <4 x i32>, <4 x i32>* %P         ; <<4 x i32>> [#uses=1]
16*9880d681SAndroid Build Coastguard Worker        %S = sub <4 x i32> zeroinitializer, %T          ; <<4 x i32>> [#uses=1]
17*9880d681SAndroid Build Coastguard Worker        store <4 x i32> %S, <4 x i32>* %P
18*9880d681SAndroid Build Coastguard Worker        ret void
19*9880d681SAndroid Build Coastguard Worker}
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; Without any type hints from operations, we fall back to the smaller xorps.
22*9880d681SAndroid Build Coastguard Worker; The IR type <4 x i32> is ignored.
23*9880d681SAndroid Build Coastguard Worker; CHECK: untyped_zero
24*9880d681SAndroid Build Coastguard Worker; CHECK: xorps
25*9880d681SAndroid Build Coastguard Worker; CHECK: movaps
26*9880d681SAndroid Build Coastguard Workerdefine void @untyped_zero(<4 x i32>* %p) {
27*9880d681SAndroid Build Coastguard Workerentry:
28*9880d681SAndroid Build Coastguard Worker  store <4 x i32> zeroinitializer, <4 x i32>* %p, align 16
29*9880d681SAndroid Build Coastguard Worker  ret void
30*9880d681SAndroid Build Coastguard Worker}
31