1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt < %s -passes='sroa' -S | FileCheck %s
3 define double @phi_with_nsz(double %x) "no-signed-zeros-fp-math"="true" {
4 ; CHECK-LABEL: define double @phi_with_nsz(
5 ; CHECK-SAME: double [[X:%.*]]) #[[ATTR0:[0-9]+]] {
7 ; CHECK-NEXT: [[CMP:%.*]] = fcmp olt double [[X]], 0.000000e+00
8 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
10 ; CHECK-NEXT: [[FNEG:%.*]] = fneg double [[X]]
11 ; CHECK-NEXT: br label [[RETURN]]
13 ; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi nsz double [ [[FNEG]], [[IF_THEN]] ], [ undef, [[ENTRY:%.*]] ]
14 ; CHECK-NEXT: ret double [[X_ADDR_0]]
16 %x.addr = alloca double
17 %cmp = fcmp olt double %x, 0.0
18 br i1 %cmp, label %if.then, label %return
20 if.then: ; preds = %entry
21 %fneg = fneg double %x
22 store double %fneg, ptr %x.addr
25 return: ; preds = %entry,%if.then
26 %retval = load double, ptr %x.addr
30 define <2 x double> @vector_phi_with_nsz(<2 x double> %x, i1 %cmp, <2 x double> %a, <2 x double> %b) "no-signed-zeros-fp-math"="true" {
31 ; CHECK-LABEL: define <2 x double> @vector_phi_with_nsz(
32 ; CHECK-SAME: <2 x double> [[X:%.*]], i1 [[CMP:%.*]], <2 x double> [[A:%.*]], <2 x double> [[B:%.*]]) #[[ATTR0]] {
34 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
36 ; CHECK-NEXT: br label [[RETURN]]
38 ; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi nsz <2 x double> [ [[B]], [[IF_THEN]] ], [ [[A]], [[ENTRY:%.*]] ]
39 ; CHECK-NEXT: ret <2 x double> [[X_ADDR_0]]
41 %x.addr = alloca <2 x double>
42 store <2 x double> %a, ptr %x.addr
43 br i1 %cmp, label %if.then, label %return
45 if.then: ; preds = %entry
46 store <2 x double> %b, ptr %x.addr
49 return: ; preds = %entry,%if.then
50 %retval = load <2 x double>, ptr %x.addr
51 ret <2 x double> %retval
54 define double @phi_without_nsz(double %x) "no-signed-zeros-fp-math"="false" {
55 ; CHECK-LABEL: define double @phi_without_nsz(
56 ; CHECK-SAME: double [[X:%.*]]) #[[ATTR1:[0-9]+]] {
58 ; CHECK-NEXT: [[CMP:%.*]] = fcmp olt double [[X]], 0.000000e+00
59 ; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
61 ; CHECK-NEXT: [[FNEG:%.*]] = fneg double [[X]]
62 ; CHECK-NEXT: br label [[RETURN]]
64 ; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi double [ [[FNEG]], [[IF_THEN]] ], [ undef, [[ENTRY:%.*]] ]
65 ; CHECK-NEXT: ret double [[X_ADDR_0]]
67 %x.addr = alloca double
68 %cmp = fcmp olt double %x, 0.0
69 br i1 %cmp, label %if.then, label %return
71 if.then: ; preds = %entry
72 %fneg = fneg double %x
73 store double %fneg, ptr %x.addr
76 return: ; preds = %entry,%if.then
77 %retval = load double, ptr %x.addr