1,048 changes: 524 additions & 524 deletions clang/test/Headers/__clang_hip_math.hip

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions clang/test/Headers/__clang_hip_math_ocml_rounded_ops.hip

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions clang/test/Headers/amdgcn_openmp_device_math.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,21 @@
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
// CHECK-CPP-NEXT: store double [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 8
// CHECK-CPP-NEXT: [[TMP1:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I]], align 8
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call double @__ocml_sin_f64(double noundef [[TMP1]]) #[[ATTR3:[0-9]+]]
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef double @__ocml_sin_f64(double noundef [[TMP1]]) #[[ATTR3:[0-9]+]]
// CHECK-CPP-NEXT: store double [[CALL_I]], ptr [[L1_ASCAST]], align 8
// CHECK-CPP-NEXT: [[TMP2:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
// CHECK-CPP-NEXT: store double [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 8
// CHECK-CPP-NEXT: [[TMP3:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I7]], align 8
// CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call double @__ocml_cos_f64(double noundef [[TMP3]]) #[[ATTR3]]
// CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call noundef double @__ocml_cos_f64(double noundef [[TMP3]]) #[[ATTR3]]
// CHECK-CPP-NEXT: store double [[CALL_I8]], ptr [[L2_ASCAST]], align 8
// CHECK-CPP-NEXT: [[TMP4:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
// CHECK-CPP-NEXT: store double [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 8
// CHECK-CPP-NEXT: [[TMP5:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I12]], align 8
// CHECK-CPP-NEXT: [[TMP6:%.*]] = call double @llvm.fabs.f64(double [[TMP5]])
// CHECK-CPP-NEXT: [[TMP6:%.*]] = call noundef double @llvm.fabs.f64(double [[TMP5]])
// CHECK-CPP-NEXT: store double [[TMP6]], ptr [[L3_ASCAST]], align 8
// CHECK-CPP-NEXT: [[TMP7:%.*]] = load double, ptr [[X_ADDR_ASCAST]], align 8
// CHECK-CPP-NEXT: [[TMP8:%.*]] = load double, ptr [[Y_ADDR_ASCAST]], align 8
Expand All @@ -142,7 +142,7 @@
// CHECK-CPP-NEXT: [[TMP10:%.*]] = load double, ptr [[__X_ADDR_ASCAST_I16]], align 8
// CHECK-CPP-NEXT: [[TMP11:%.*]] = load double, ptr [[__Y_ADDR_ASCAST_I]], align 8
// CHECK-CPP-NEXT: [[TMP12:%.*]] = load double, ptr [[__Z_ADDR_ASCAST_I]], align 8
// CHECK-CPP-NEXT: [[TMP13:%.*]] = call double @llvm.fma.f64(double [[TMP10]], double [[TMP11]], double [[TMP12]])
// CHECK-CPP-NEXT: [[TMP13:%.*]] = call noundef double @llvm.fma.f64(double [[TMP10]], double [[TMP11]], double [[TMP12]])
// CHECK-CPP-NEXT: store double [[TMP13]], ptr [[L4_ASCAST]], align 8
// CHECK-CPP-NEXT: ret void
//
Expand Down Expand Up @@ -278,7 +278,7 @@ void test_math_f64(double x, double y, double z) {
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I22:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I20]] to ptr
// CHECK-CPP-NEXT: store float [[TMP1]], ptr [[__X_ADDR_ASCAST_I22]], align 4
// CHECK-CPP-NEXT: [[TMP2:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I22]], align 4
// CHECK-CPP-NEXT: [[CALL_I23:%.*]] = call float @__ocml_sin_f32(float noundef [[TMP2]]) #[[ATTR3]]
// CHECK-CPP-NEXT: [[CALL_I23:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP2]]) #[[ATTR3]]
// CHECK-CPP-NEXT: store float [[CALL_I23]], ptr [[L1_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP3:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
Expand All @@ -289,7 +289,7 @@ void test_math_f64(double x, double y, double z) {
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I27:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I25]] to ptr
// CHECK-CPP-NEXT: store float [[TMP4]], ptr [[__X_ADDR_ASCAST_I27]], align 4
// CHECK-CPP-NEXT: [[TMP5:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I27]], align 4
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call float @__ocml_cos_f32(float noundef [[TMP5]]) #[[ATTR3]]
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP5]]) #[[ATTR3]]
// CHECK-CPP-NEXT: store float [[CALL_I]], ptr [[L2_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP6:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
Expand All @@ -300,7 +300,7 @@ void test_math_f64(double x, double y, double z) {
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I31:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I29]] to ptr
// CHECK-CPP-NEXT: store float [[TMP7]], ptr [[__X_ADDR_ASCAST_I31]], align 4
// CHECK-CPP-NEXT: [[TMP8:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I31]], align 4
// CHECK-CPP-NEXT: [[TMP9:%.*]] = call float @llvm.fabs.f32(float [[TMP8]])
// CHECK-CPP-NEXT: [[TMP9:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP8]])
// CHECK-CPP-NEXT: store float [[TMP9]], ptr [[L3_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP10:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP11:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
Expand All @@ -325,7 +325,7 @@ void test_math_f64(double x, double y, double z) {
// CHECK-CPP-NEXT: [[TMP16:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I37]], align 4
// CHECK-CPP-NEXT: [[TMP17:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I38]], align 4
// CHECK-CPP-NEXT: [[TMP18:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I39]], align 4
// CHECK-CPP-NEXT: [[TMP19:%.*]] = call float @llvm.fma.f32(float [[TMP16]], float [[TMP17]], float [[TMP18]])
// CHECK-CPP-NEXT: [[TMP19:%.*]] = call noundef float @llvm.fma.f32(float [[TMP16]], float [[TMP17]], float [[TMP18]])
// CHECK-CPP-NEXT: store float [[TMP19]], ptr [[L4_ASCAST]], align 4
// CHECK-CPP-NEXT: ret void
//
Expand Down Expand Up @@ -437,21 +437,21 @@ void test_math_f32(float x, float y, float z) {
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
// CHECK-CPP-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-CPP-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-CPP-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-CPP-NEXT: store float [[CALL_I]], ptr [[L1_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP2:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I6:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I4]] to ptr
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I7:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I5]] to ptr
// CHECK-CPP-NEXT: store float [[TMP2]], ptr [[__X_ADDR_ASCAST_I7]], align 4
// CHECK-CPP-NEXT: [[TMP3:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I7]], align 4
// CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call float @__ocml_cos_f32(float noundef [[TMP3]]) #[[ATTR3]]
// CHECK-CPP-NEXT: [[CALL_I8:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP3]]) #[[ATTR3]]
// CHECK-CPP-NEXT: store float [[CALL_I8]], ptr [[L2_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP4:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[RETVAL_ASCAST_I11:%.*]] = addrspacecast ptr addrspace(5) [[RETVAL_I9]] to ptr
// CHECK-CPP-NEXT: [[__X_ADDR_ASCAST_I12:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I10]] to ptr
// CHECK-CPP-NEXT: store float [[TMP4]], ptr [[__X_ADDR_ASCAST_I12]], align 4
// CHECK-CPP-NEXT: [[TMP5:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I12]], align 4
// CHECK-CPP-NEXT: [[TMP6:%.*]] = call float @llvm.fabs.f32(float [[TMP5]])
// CHECK-CPP-NEXT: [[TMP6:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP5]])
// CHECK-CPP-NEXT: store float [[TMP6]], ptr [[L3_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP7:%.*]] = load float, ptr [[X_ADDR_ASCAST]], align 4
// CHECK-CPP-NEXT: [[TMP8:%.*]] = load float, ptr [[Y_ADDR_ASCAST]], align 4
Expand All @@ -466,7 +466,7 @@ void test_math_f32(float x, float y, float z) {
// CHECK-CPP-NEXT: [[TMP10:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I16]], align 4
// CHECK-CPP-NEXT: [[TMP11:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-CPP-NEXT: [[TMP12:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I]], align 4
// CHECK-CPP-NEXT: [[TMP13:%.*]] = call float @llvm.fma.f32(float [[TMP10]], float [[TMP11]], float [[TMP12]])
// CHECK-CPP-NEXT: [[TMP13:%.*]] = call noundef float @llvm.fma.f32(float [[TMP10]], float [[TMP11]], float [[TMP12]])
// CHECK-CPP-NEXT: store float [[TMP13]], ptr [[L4_ASCAST]], align 4
// CHECK-CPP-NEXT: ret void
//
Expand Down
24 changes: 12 additions & 12 deletions clang/test/Headers/amdgcn_openmp_device_math_constexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
// CHECK-NEXT: store float -2.000000e+00, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.fabs.f32(float [[TMP0]])
// CHECK-NEXT: [[TMP1:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP0]])
// CHECK-NEXT: store float [[TMP1]], ptr addrspacecast (ptr addrspace(1) @_ZL19constexpr_fabsf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -64,7 +64,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I_I]] to ptr
// CHECK-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = call float @llvm.fabs.f32(float [[TMP1]])
// CHECK-NEXT: [[TMP2:%.*]] = call noundef float @llvm.fabs.f32(float [[TMP1]])
// CHECK-NEXT: store float [[TMP2]], ptr addrspacecast (ptr addrspace(1) @_ZL18constexpr_fabs_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -78,7 +78,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
// CHECK-NEXT: store float -2.000000e+00, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[CALL_I:%.*]] = call float @__ocml_sin_f32(float noundef [[TMP0]]) #[[ATTR3:[0-9]+]]
// CHECK-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP0]]) #[[ATTR3:[0-9]+]]
// CHECK-NEXT: store float [[CALL_I]], ptr addrspacecast (ptr addrspace(1) @_ZL18constexpr_sinf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -98,7 +98,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I_I]] to ptr
// CHECK-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[CALL_I_I:%.*]] = call float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-NEXT: [[CALL_I_I:%.*]] = call noundef float @__ocml_sin_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-NEXT: store float [[CALL_I_I]], ptr addrspacecast (ptr addrspace(1) @_ZL17constexpr_sin_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -112,7 +112,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I]] to ptr
// CHECK-NEXT: store float -2.000000e+00, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[CALL_I:%.*]] = call float @__ocml_cos_f32(float noundef [[TMP0]]) #[[ATTR3]]
// CHECK-NEXT: [[CALL_I:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP0]]) #[[ATTR3]]
// CHECK-NEXT: store float [[CALL_I]], ptr addrspacecast (ptr addrspace(1) @_ZL18constexpr_cosf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -132,7 +132,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[__X_ADDR_ASCAST_I_I:%.*]] = addrspacecast ptr addrspace(5) [[__X_ADDR_I_I]] to ptr
// CHECK-NEXT: store float [[TMP0]], ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[CALL_I_I:%.*]] = call float @__ocml_cos_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-NEXT: [[CALL_I_I:%.*]] = call noundef float @__ocml_cos_f32(float noundef [[TMP1]]) #[[ATTR3]]
// CHECK-NEXT: store float [[CALL_I_I]], ptr addrspacecast (ptr addrspace(1) @_ZL17constexpr_cos_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -154,7 +154,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP3:%.*]] = call float @llvm.fma.f32(float [[TMP0]], float [[TMP1]], float [[TMP2]])
// CHECK-NEXT: [[TMP3:%.*]] = call noundef float @llvm.fma.f32(float [[TMP0]], float [[TMP1]], float [[TMP2]])
// CHECK-NEXT: store float [[TMP3]], ptr addrspacecast (ptr addrspace(1) @_ZL18constexpr_fmaf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand Down Expand Up @@ -190,7 +190,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: [[TMP3:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP4:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP5:%.*]] = load float, ptr [[__Z_ADDR_ASCAST_I_I]], align 4
// CHECK-NEXT: [[TMP6:%.*]] = call float @llvm.fma.f32(float [[TMP3]], float [[TMP4]], float [[TMP5]])
// CHECK-NEXT: [[TMP6:%.*]] = call noundef float @llvm.fma.f32(float [[TMP3]], float [[TMP4]], float [[TMP5]])
// CHECK-NEXT: store float [[TMP6]], ptr addrspacecast (ptr addrspace(1) @_ZL17constexpr_fma_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -208,7 +208,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: store float -4.000000e+00, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = call float @llvm.minnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: [[TMP2:%.*]] = call noundef float @llvm.minnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: store float [[TMP2]], ptr addrspacecast (ptr addrspace(1) @_ZL17constexpr_min_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -226,7 +226,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: store float -4.000000e+00, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = call float @llvm.maxnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: [[TMP2:%.*]] = call noundef float @llvm.maxnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: store float [[TMP2]], ptr addrspacecast (ptr addrspace(1) @_ZL17constexpr_max_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand Down Expand Up @@ -260,7 +260,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: store float -4.000000e+00, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = call float @llvm.minnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: [[TMP2:%.*]] = call noundef float @llvm.minnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: store float [[TMP2]], ptr addrspacecast (ptr addrspace(1) @_ZL19constexpr_fminf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
Expand All @@ -278,7 +278,7 @@ const float constexpr_fmaxf_f32 = fmaxf(2.0f, -4.0f);
// CHECK-NEXT: store float -4.000000e+00, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP0:%.*]] = load float, ptr [[__X_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[__Y_ADDR_ASCAST_I]], align 4
// CHECK-NEXT: [[TMP2:%.*]] = call float @llvm.maxnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: [[TMP2:%.*]] = call noundef float @llvm.maxnum.f32(float [[TMP0]], float [[TMP1]])
// CHECK-NEXT: store float [[TMP2]], ptr addrspacecast (ptr addrspace(1) @_ZL19constexpr_fmaxf_f32 to ptr), align 4
// CHECK-NEXT: ret void
//
10 changes: 5 additions & 5 deletions clang/test/Headers/hip-header.hip
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ __device__ void test_numeric_type() {
// instead of fma(_Float16, _Float16, _Float16).

// CXX14-LABEL: define{{.*}}@_Z8test_fma
// CXX14: call contract half @llvm.fma.f16
// CXX14: call contract noundef half @llvm.fma.f16
__device__ double test_fma(_Float16 h, int i) {
return fma(h, h, i);
}
Expand Down Expand Up @@ -149,12 +149,12 @@ __device__ double test_isnan() {
double d = 5.0;
float f = 5.0;

// AMD_INT_RETURN: call i1 @llvm.is.fpclass.f32(float {{.*}}, i32 3)
// AMD_BOOL_RETURN: call i1 @llvm.is.fpclass.f32(float {{.*}}, i32 3)
// AMD_INT_RETURN: call noundef i1 @llvm.is.fpclass.f32(float {{.*}}, i32 3)
// AMD_BOOL_RETURN: call noundef i1 @llvm.is.fpclass.f32(float {{.*}}, i32 3)
r += isnan(f);

// AMD_INT_RETURN: call i1 @llvm.is.fpclass.f64(double {{.*}}, i32 3)
// AMD_BOOL_RETURN: call i1 @llvm.is.fpclass.f64(double {{.*}}, i32 3)
// AMD_INT_RETURN: call noundef i1 @llvm.is.fpclass.f64(double {{.*}}, i32 3)
// AMD_BOOL_RETURN: call noundef i1 @llvm.is.fpclass.f64(double {{.*}}, i32 3)
r += isnan(d);

return r ;
Expand Down
10 changes: 5 additions & 5 deletions clang/test/Headers/nvptx_device_cmath_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
void test_sqrt(double a1) {
#pragma omp target
{
// CHECK-YES: call double @__nv_sqrt(double
// CHECK-YES: call noundef double @__nv_sqrt(double
double l1 = sqrt(a1);
// CHECK-YES: call double @__nv_pow(double
// CHECK-YES: call noundef double @__nv_pow(double
double l2 = pow(a1, a1);
// CHECK-YES: call double @__nv_modf(double
// CHECK-YES: call noundef double @__nv_modf(double
double l3 = modf(a1 + 3.5, &a1);
// CHECK-YES: call double @__nv_fabs(double
// CHECK-YES: call noundef double @__nv_fabs(double
double l4 = fabs(a1);
// CHECK-YES: call i32 @__nv_abs(i32
// CHECK-YES: call noundef i32 @__nv_abs(i32
double l5 = abs((int)a1);
}
}
10 changes: 5 additions & 5 deletions clang/test/Headers/nvptx_device_cmath_functions_cxx17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
void test_sqrt(double a1) {
#pragma omp target
{
// CHECK-YES: call double @__nv_sqrt(double
// CHECK-YES: call noundef double @__nv_sqrt(double
double l1 = sqrt(a1);
// CHECK-YES: call double @__nv_pow(double
// CHECK-YES: call noundef double @__nv_pow(double
double l2 = pow(a1, a1);
// CHECK-YES: call double @__nv_modf(double
// CHECK-YES: call noundef double @__nv_modf(double
double l3 = modf(a1 + 3.5, &a1);
// CHECK-YES: call double @__nv_fabs(double
// CHECK-YES: call noundef double @__nv_fabs(double
double l4 = fabs(a1);
// CHECK-YES: call i32 @__nv_abs(i32
// CHECK-YES: call noundef i32 @__nv_abs(i32
double l5 = abs((int)a1);
}
}
19 changes: 12 additions & 7 deletions clang/test/Headers/nvptx_device_math_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
// REQUIRES: nvptx-registered-target

// RUN: %clang_cc1 -x c -internal-isystem %S/Inputs/include -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
// RUN: %clang_cc1 -x c -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -triple nvptx64-nvidia-cuda -aux-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
// RUN: %clang_cc1 -x c -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -triple nvptx64-nvidia-cuda -aux-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=CHECK-C
// RUN: %clang_cc1 -x c++ -internal-isystem %S/Inputs/include -fopenmp -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
// RUN: %clang_cc1 -x c++ -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -triple nvptx64-nvidia-cuda -aux-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
// RUN: %clang_cc1 -x c++ -internal-isystem %S/../../lib/Headers/openmp_wrappers -include __clang_openmp_device_functions.h -internal-isystem %S/Inputs/include -fopenmp -triple nvptx64-nvidia-cuda -aux-triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=CHECK-CXX

#ifdef __cplusplus
#include <cstdlib>
Expand All @@ -19,15 +19,20 @@
void test_sqrt(double a1) {
#pragma omp target
{
// CHECK: call double @__nv_sqrt(double
// CHECK-C: call double @__nv_sqrt(double
// CHECK-CXX: call noundef double @__nv_sqrt(double
double l1 = sqrt(a1);
// CHECK: call double @__nv_pow(double
// CHECK-C: call double @__nv_pow(double
// CHECK-CXX: call noundef double @__nv_pow(double
double l2 = pow(a1, a1);
// CHECK: call double @__nv_modf(double
// CHECK-C: call double @__nv_modf(double
// CHECK-CXX: call noundef double @__nv_modf(double
double l3 = modf(a1 + 3.5, &a1);
// CHECK: call double @__nv_fabs(double
// CHECK-C: call double @__nv_fabs(double
// CHECK-CXX: call noundef double @__nv_fabs(double
double l4 = fabs(a1);
// CHECK: call i32 @__nv_abs(i32
// CHECK-C: call i32 @__nv_abs(i32
// CHECK-CXX: call noundef i32 @__nv_abs(i32
double l5 = abs((int)a1);
}
}
10 changes: 5 additions & 5 deletions clang/test/Headers/nvptx_device_math_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
void test_sqrt(double a1) {
#pragma omp target
{
// CHECK-YES: call double @__nv_sqrt(double
// CHECK-YES: call noundef double @__nv_sqrt(double
double l1 = sqrt(a1);
// CHECK-YES: call double @__nv_pow(double
// CHECK-YES: call noundef double @__nv_pow(double
double l2 = pow(a1, a1);
// CHECK-YES: call double @__nv_modf(double
// CHECK-YES: call noundef double @__nv_modf(double
double l3 = modf(a1 + 3.5, &a1);
// CHECK-YES: call double @__nv_fabs(double
// CHECK-YES: call noundef double @__nv_fabs(double
double l4 = fabs(a1);
// CHECK-YES: call i32 @__nv_abs(i32
// CHECK-YES: call noundef i32 @__nv_abs(i32
double l5 = abs((int)a1);
}
}
10 changes: 5 additions & 5 deletions clang/test/Headers/nvptx_device_math_functions_cxx17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
void test_sqrt(double a1) {
#pragma omp target
{
// CHECK-YES: call double @__nv_sqrt(double
// CHECK-YES: call noundef double @__nv_sqrt(double
double l1 = sqrt(a1);
// CHECK-YES: call double @__nv_pow(double
// CHECK-YES: call noundef double @__nv_pow(double
double l2 = pow(a1, a1);
// CHECK-YES: call double @__nv_modf(double
// CHECK-YES: call noundef double @__nv_modf(double
double l3 = modf(a1 + 3.5, &a1);
// CHECK-YES: call double @__nv_fabs(double
// CHECK-YES: call noundef double @__nv_fabs(double
double l4 = fabs(a1);
// CHECK-YES: call i32 @__nv_abs(i32
// CHECK-YES: call noundef i32 @__nv_abs(i32
double l5 = abs((int)a1);
}
}
8 changes: 4 additions & 4 deletions clang/test/Headers/nvptx_device_math_modf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
// 4 calls to modf(f), all translated to __nv_modf calls:

// CHECK-NOT: _Z.modf
// CHECK: call double @__nv_modf(double
// CHECK: call noundef double @__nv_modf(double
// CHECK-NOT: _Z.modf
// CHECK: call float @__nv_modff(float
// CHECK: call noundef float @__nv_modff(float
// CHECK-NOT: _Z.modf
// CHECK: call double @__nv_modf(double
// CHECK: call noundef double @__nv_modf(double
// CHECK-NOT: _Z.modf
// CHECK: call float @__nv_modff(float
// CHECK: call noundef float @__nv_modff(float
// CHECK-NOT: _Z.modf

template<typename T>
Expand Down
8 changes: 4 additions & 4 deletions clang/test/Headers/nvptx_device_math_sin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

double math(float f, double d) {
double r = 0;
// SLOW: call float @__nv_sinf(float
// FAST: call fast nofpclass(nan inf) float @__nv_fast_sinf(float
// SLOW: call noundef float @__nv_sinf(float
// FAST: call fast noundef nofpclass(nan inf) float @__nv_fast_sinf(float
r += sin(f);
// SLOW: call double @__nv_sin(double
// FAST: call fast nofpclass(nan inf) double @__nv_sin(double
// SLOW: call noundef double @__nv_sin(double
// FAST: call fast noundef nofpclass(nan inf) double @__nv_sin(double
r += sin(d);
return r;
}
Expand Down
12 changes: 6 additions & 6 deletions clang/test/Headers/nvptx_device_math_sin_cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call double @__nv_sin(double
// CHECK: call noundef double @__nv_sin(double
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call float @__nv_sinf(float
// CHECK: call noundef float @__nv_sinf(float
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call double @__nv_sin(double
// CHECK: call noundef double @__nv_sin(double
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call double @__nv_cos(double
// CHECK: call noundef double @__nv_cos(double
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call float @__nv_sinf(float
// CHECK: call noundef float @__nv_sinf(float
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos
// CHECK: call float @__nv_cosf(float
// CHECK: call noundef float @__nv_cosf(float
// CHECK-NOT: _Z.sin
// CHECK-NOT: _Z.cos

Expand Down
8 changes: 4 additions & 4 deletions clang/test/Headers/openmp_device_math_isnan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@

double math(float f, double d) {
double r = 0;
// INT_RETURN: call i32 @__nv_isnanf(float
// INT_RETURN: call noundef i32 @__nv_isnanf(float
// AMD_INT_RETURN_SAFE: call i1 @llvm.is.fpclass.f32(float{{.*}}, i32 3)
// AMD_INT_RETURN_FAST: sitofp i32 {{.*}} to double
// BOOL_RETURN: call i32 @__nv_isnanf(float
// BOOL_RETURN: call noundef i32 @__nv_isnanf(float
// AMD_BOOL_RETURN_SAFE: call i1 @llvm.is.fpclass.f32(float{{.*}}, i32 3)
// AMD_BOOL_RETURN_FAST: icmp ne i32 {{.*}}, 0
r += std::isnan(f);
// INT_RETURN: call i32 @__nv_isnand(double
// INT_RETURN: call noundef i32 @__nv_isnand(double
// AMD_INT_RETURN_SAFE: call i1 @llvm.is.fpclass.f64(double{{.*}}, i32 3)
// AMD_INT_RETURN_FAST: sitofp i32 {{.*}} to double
// BOOL_RETURN: call i32 @__nv_isnand(double
// BOOL_RETURN: call noundef i32 @__nv_isnand(double
// AMD_BOOL_RETURN_SAFE: call i1 @llvm.is.fpclass.f64(double{{.*}}, i32 3)
// AMD_BOOL_RETURN_FAST: icmp ne i32 {{.*}}, 0
r += std::isnan(d);
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Transforms/Utils/InlineFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,8 @@ static AttrBuilder IdentifyValidUBGeneratingAttributes(CallBase &CB) {
Valid.addDereferenceableOrNullAttr(DerefOrNullBytes);
if (CB.hasRetAttr(Attribute::NoAlias))
Valid.addAttribute(Attribute::NoAlias);
if (CB.hasRetAttr(Attribute::NoUndef))
Valid.addAttribute(Attribute::NoUndef);
return Valid;
}

Expand All @@ -1367,6 +1369,8 @@ static AttrBuilder IdentifyValidPoisonGeneratingAttributes(CallBase &CB) {
AttrBuilder Valid(CB.getContext());
if (CB.hasRetAttr(Attribute::NonNull))
Valid.addAttribute(Attribute::NonNull);
if (CB.hasRetAttr(Attribute::Alignment))
Valid.addAlignmentAttr(CB.getRetAlign());
return Valid;
}

Expand Down Expand Up @@ -1455,6 +1459,8 @@ static void AddReturnAttributes(CallBase &CB, ValueToValueMapTy &VMap) {
// any new poison at @use will trigger UB anyways.
// In case 3, we can never propagate nonnull because it may create UB due to
// the noundef on @bar.
if (ValidPG.getAlignment().valueOrOne() < AL.getRetAlignment().valueOrOne())
ValidPG.removeAttribute(Attribute::Alignment);
if (ValidPG.hasAttributes()) {
// Three checks.
// If the callsite has `noundef`, then a poison due to violating the
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Transforms/Inline/ret_attr_align_and_noundef.ll
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define ptr @caller0() {

define ptr @caller1() {
; CHECK-LABEL: define ptr @caller1() {
; CHECK-NEXT: [[R_I:%.*]] = call ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call align 16 ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call align(16) ptr @callee0123()
Expand All @@ -39,7 +39,7 @@ define ptr @caller1() {

define ptr @caller2() {
; CHECK-LABEL: define ptr @caller2() {
; CHECK-NEXT: [[R_I:%.*]] = call ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call noundef ptr @callee0123()
Expand All @@ -57,7 +57,7 @@ define ptr @caller3() {

define ptr @caller_0123_dornull() {
; CHECK-LABEL: define ptr @caller_0123_dornull() {
; CHECK-NEXT: [[R_I:%.*]] = call dereferenceable_or_null(16) ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef align 32 dereferenceable_or_null(16) ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call noundef align(32) dereferenceable_or_null(16) ptr @callee0123()
Expand All @@ -66,7 +66,7 @@ define ptr @caller_0123_dornull() {

define ptr @caller_0123_d() {
; CHECK-LABEL: define ptr @caller_0123_d() {
; CHECK-NEXT: [[R_I:%.*]] = call dereferenceable(16) ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef align 32 dereferenceable(16) ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call noundef align(32) dereferenceable(16) ptr @callee0123()
Expand Down Expand Up @@ -105,7 +105,7 @@ define ptr @callee5() {

define ptr @caller5_fail() {
; CHECK-LABEL: define ptr @caller5_fail() {
; CHECK-NEXT: [[R_I:%.*]] = call align 64 ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef align 64 ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call noundef align(32) ptr @callee5()
Expand All @@ -114,7 +114,7 @@ define ptr @caller5_fail() {

define ptr @caller5_okay() {
; CHECK-LABEL: define ptr @caller5_okay() {
; CHECK-NEXT: [[R_I:%.*]] = call align 64 ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef align 128 ptr @foo()
; CHECK-NEXT: ret ptr [[R_I]]
;
%r = call noundef align(128) ptr @callee5()
Expand Down Expand Up @@ -249,7 +249,7 @@ define ptr @caller10_fail_maybe_poison() {

define ptr @caller10_okay_will_be_ub() {
; CHECK-LABEL: define ptr @caller10_okay_will_be_ub() {
; CHECK-NEXT: [[R_I:%.*]] = call nonnull ptr @foo()
; CHECK-NEXT: [[R_I:%.*]] = call noundef nonnull ptr @foo()
; CHECK-NEXT: call void @use.ptr(ptr [[R_I]])
; CHECK-NEXT: ret ptr [[R_I]]
;
Expand Down