xref: /llvm-project/llvm/test/Transforms/EarlyCSE/floatingpoint.ll (revision ac696ac4530fb3df626195e94e83649bf7114754)
160147c60SNikita Popov; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*ac696ac4SBjorn Pettersson; RUN: opt < %s -S -passes=early-cse -earlycse-debug-hash | FileCheck %s
3c384b20bSArthur Eubanks; RUN: opt < %s -S -passes='early-cse<memssa>' | FileCheck %s
4cee313d2SEric Christopher
5cee313d2SEric Christopher; Ensure we don't simplify away additions vectors of +0.0's (same as scalars).
6cee313d2SEric Christopherdefine <4 x float> @fV( <4 x float> %a) {
760147c60SNikita Popov; CHECK-LABEL: @fV(
860147c60SNikita Popov; CHECK-NEXT:    [[B:%.*]] = fadd <4 x float> [[A:%.*]], zeroinitializer
960147c60SNikita Popov; CHECK-NEXT:    ret <4 x float> [[B]]
1060147c60SNikita Popov;
11cee313d2SEric Christopher  %b = fadd  <4 x float> %a, <float 0.0,float 0.0,float 0.0,float 0.0>
12cee313d2SEric Christopher  ret <4 x float> %b
13cee313d2SEric Christopher}
14cee313d2SEric Christopher
15cee313d2SEric Christopherdefine <4 x float> @fW( <4 x float> %a) {
1660147c60SNikita Popov; CHECK-LABEL: @fW(
1760147c60SNikita Popov; CHECK-NEXT:    ret <4 x float> [[A:%.*]]
1860147c60SNikita Popov;
19cee313d2SEric Christopher  %b = fadd  <4 x float> %a, <float -0.0,float -0.0,float -0.0,float -0.0>
20cee313d2SEric Christopher  ret <4 x float> %b
21cee313d2SEric Christopher}
229c52f66fSCameron McInally
239c52f66fSCameron McInally; CSE unary fnegs.
243c514d31SNikita Popovdefine void @fX(ptr%p, <4 x float> %a) {
2560147c60SNikita Popov; CHECK-LABEL: @fX(
2660147c60SNikita Popov; CHECK-NEXT:    [[X:%.*]] = fneg <4 x float> [[A:%.*]]
273c514d31SNikita Popov; CHECK-NEXT:    store volatile <4 x float> [[X]], ptr [[P:%.*]], align 16
283c514d31SNikita Popov; CHECK-NEXT:    store volatile <4 x float> [[X]], ptr [[P]], align 16
2960147c60SNikita Popov; CHECK-NEXT:    ret void
3060147c60SNikita Popov;
319c52f66fSCameron McInally  %x = fneg <4 x float> %a
329c52f66fSCameron McInally  %y = fneg <4 x float> %a
333c514d31SNikita Popov  store volatile <4 x float> %x, ptr %p
343c514d31SNikita Popov  store volatile <4 x float> %y, ptr %p
359c52f66fSCameron McInally  ret void
369c52f66fSCameron McInally}
37