xref: /llvm-project/llvm/test/Transforms/EarlyCSE/floatingpoint.ll (revision ac696ac4530fb3df626195e94e83649bf7114754)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -S -passes=early-cse -earlycse-debug-hash | FileCheck %s
3; RUN: opt < %s -S -passes='early-cse<memssa>' | FileCheck %s
4
5; Ensure we don't simplify away additions vectors of +0.0's (same as scalars).
6define <4 x float> @fV( <4 x float> %a) {
7; CHECK-LABEL: @fV(
8; CHECK-NEXT:    [[B:%.*]] = fadd <4 x float> [[A:%.*]], zeroinitializer
9; CHECK-NEXT:    ret <4 x float> [[B]]
10;
11  %b = fadd  <4 x float> %a, <float 0.0,float 0.0,float 0.0,float 0.0>
12  ret <4 x float> %b
13}
14
15define <4 x float> @fW( <4 x float> %a) {
16; CHECK-LABEL: @fW(
17; CHECK-NEXT:    ret <4 x float> [[A:%.*]]
18;
19  %b = fadd  <4 x float> %a, <float -0.0,float -0.0,float -0.0,float -0.0>
20  ret <4 x float> %b
21}
22
23; CSE unary fnegs.
24define void @fX(ptr%p, <4 x float> %a) {
25; CHECK-LABEL: @fX(
26; CHECK-NEXT:    [[X:%.*]] = fneg <4 x float> [[A:%.*]]
27; CHECK-NEXT:    store volatile <4 x float> [[X]], ptr [[P:%.*]], align 16
28; CHECK-NEXT:    store volatile <4 x float> [[X]], ptr [[P]], align 16
29; CHECK-NEXT:    ret void
30;
31  %x = fneg <4 x float> %a
32  %y = fneg <4 x float> %a
33  store volatile <4 x float> %x, ptr %p
34  store volatile <4 x float> %y, ptr %p
35  ret void
36}
37