Skip to content

Commit 77ad097

Browse files
committed
fix testcases
1 parent 4cb7472 commit 77ad097

File tree

2 files changed

+54
-30
lines changed

2 files changed

+54
-30
lines changed

clang/test/CodeGen/fmaxnum_fminnum_use_nsz.c

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,50 @@ double fmax (double, double);
88
long double fmaxl (long double, long double);
99

1010
// CHECK: call nsz float @llvm.minnum.f32
11-
float fmin1(float a, float b) {
11+
float fmin32(float a, float b) {
1212
return fminf(a, b);
1313
}
14+
// CHECK: call nsz float @llvm.minnum.f32
15+
float fmin32b(float a, float b) {
16+
return __builtin_fminf(a, b);
17+
}
1418
// CHECK: call nsz double @llvm.minnum.f64
15-
float fmin2(double a, double b) {
19+
float fmin64(double a, double b) {
1620
return fmin(a, b);
1721
}
22+
// CHECK: call nsz double @llvm.minnum.f64
23+
float fmin64b(double a, double b) {
24+
return __builtin_fmin(a, b);
25+
}
1826
// CHECK: call nsz x86_fp80 @llvm.minnum.f80
19-
float fmin3(long double a, long double b) {
27+
float fmin80(long double a, long double b) {
2028
return fminl(a, b);
2129
}
30+
// CHECK: call nsz x86_fp80 @llvm.minnum.f80
31+
float fmin80b(long double a, long double b) {
32+
return __builtin_fminl(a, b);
33+
}
2234
// CHECK: call nsz float @llvm.maxnum.f32
23-
float fmax1(float a, float b) {
35+
float fmax32(float a, float b) {
2436
return fmaxf(a, b);
2537
}
38+
// CHECK: call nsz float @llvm.maxnum.f32
39+
float fmax32b(float a, float b) {
40+
return __builtin_fmaxf(a, b);
41+
}
2642
// CHECK: call nsz double @llvm.maxnum.f64
27-
float fmax2(double a, double b) {
43+
float fmax64(double a, double b) {
2844
return fmax(a, b);
2945
}
46+
// CHECK: call nsz double @llvm.maxnum.f64
47+
float fmax64b(double a, double b) {
48+
return __builtin_fmax(a, b);
49+
}
3050
// CHECK: call nsz x86_fp80 @llvm.maxnum.f80
31-
float fmax3(long double a, long double b) {
51+
float fmax80(long double a, long double b) {
3252
return fmaxl(a, b);
3353
}
54+
// CHECK: call nsz x86_fp80 @llvm.maxnum.f80
55+
float fmax80b(long double a, long double b) {
56+
return __builtin_fmaxl(a, b);
57+
}

clang/test/Headers/__clang_hip_math.hip

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,17 +1248,17 @@ extern "C" __device__ double test_fma_rn(double x, double y, double z) {
12481248

12491249
// DEFAULT-LABEL: @test_fmaxf(
12501250
// DEFAULT-NEXT: entry:
1251-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1251+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
12521252
// DEFAULT-NEXT: ret float [[TMP0]]
12531253
//
12541254
// FINITEONLY-LABEL: @test_fmaxf(
12551255
// FINITEONLY-NEXT: entry:
1256-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1256+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
12571257
// FINITEONLY-NEXT: ret float [[TMP0]]
12581258
//
12591259
// APPROX-LABEL: @test_fmaxf(
12601260
// APPROX-NEXT: entry:
1261-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
1261+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
12621262
// APPROX-NEXT: ret float [[TMP0]]
12631263
//
12641264
extern "C" __device__ float test_fmaxf(float x, float y) {
@@ -1267,17 +1267,17 @@ extern "C" __device__ float test_fmaxf(float x, float y) {
12671267

12681268
// DEFAULT-LABEL: @test_fmax(
12691269
// DEFAULT-NEXT: entry:
1270-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1270+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
12711271
// DEFAULT-NEXT: ret double [[TMP0]]
12721272
//
12731273
// FINITEONLY-LABEL: @test_fmax(
12741274
// FINITEONLY-NEXT: entry:
1275-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1275+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
12761276
// FINITEONLY-NEXT: ret double [[TMP0]]
12771277
//
12781278
// APPROX-LABEL: @test_fmax(
12791279
// APPROX-NEXT: entry:
1280-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
1280+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
12811281
// APPROX-NEXT: ret double [[TMP0]]
12821282
//
12831283
extern "C" __device__ double test_fmax(double x, double y) {
@@ -1286,17 +1286,17 @@ extern "C" __device__ double test_fmax(double x, double y) {
12861286

12871287
// DEFAULT-LABEL: @test_fminf(
12881288
// DEFAULT-NEXT: entry:
1289-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1289+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
12901290
// DEFAULT-NEXT: ret float [[TMP0]]
12911291
//
12921292
// FINITEONLY-LABEL: @test_fminf(
12931293
// FINITEONLY-NEXT: entry:
1294-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1294+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
12951295
// FINITEONLY-NEXT: ret float [[TMP0]]
12961296
//
12971297
// APPROX-LABEL: @test_fminf(
12981298
// APPROX-NEXT: entry:
1299-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
1299+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
13001300
// APPROX-NEXT: ret float [[TMP0]]
13011301
//
13021302
extern "C" __device__ float test_fminf(float x, float y) {
@@ -1305,17 +1305,17 @@ extern "C" __device__ float test_fminf(float x, float y) {
13051305

13061306
// DEFAULT-LABEL: @test_fmin(
13071307
// DEFAULT-NEXT: entry:
1308-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1308+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
13091309
// DEFAULT-NEXT: ret double [[TMP0]]
13101310
//
13111311
// FINITEONLY-LABEL: @test_fmin(
13121312
// FINITEONLY-NEXT: entry:
1313-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1313+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
13141314
// FINITEONLY-NEXT: ret double [[TMP0]]
13151315
//
13161316
// APPROX-LABEL: @test_fmin(
13171317
// APPROX-NEXT: entry:
1318-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
1318+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
13191319
// APPROX-NEXT: ret double [[TMP0]]
13201320
//
13211321
extern "C" __device__ double test_fmin(double x, double y) {
@@ -5114,17 +5114,17 @@ extern "C" __device__ double test__fma_rn(double x, double y, double z) {
51145114

51155115
// DEFAULT-LABEL: @test_float_min(
51165116
// DEFAULT-NEXT: entry:
5117-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5117+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
51185118
// DEFAULT-NEXT: ret float [[TMP0]]
51195119
//
51205120
// FINITEONLY-LABEL: @test_float_min(
51215121
// FINITEONLY-NEXT: entry:
5122-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5122+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
51235123
// FINITEONLY-NEXT: ret float [[TMP0]]
51245124
//
51255125
// APPROX-LABEL: @test_float_min(
51265126
// APPROX-NEXT: entry:
5127-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
5127+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.minnum.f32(float [[X:%.*]], float [[Y:%.*]])
51285128
// APPROX-NEXT: ret float [[TMP0]]
51295129
//
51305130
extern "C" __device__ float test_float_min(float x, float y) {
@@ -5133,17 +5133,17 @@ extern "C" __device__ float test_float_min(float x, float y) {
51335133

51345134
// DEFAULT-LABEL: @test_float_max(
51355135
// DEFAULT-NEXT: entry:
5136-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5136+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
51375137
// DEFAULT-NEXT: ret float [[TMP0]]
51385138
//
51395139
// FINITEONLY-LABEL: @test_float_max(
51405140
// FINITEONLY-NEXT: entry:
5141-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5141+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
51425142
// FINITEONLY-NEXT: ret float [[TMP0]]
51435143
//
51445144
// APPROX-LABEL: @test_float_max(
51455145
// APPROX-NEXT: entry:
5146-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
5146+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef float @llvm.maxnum.f32(float [[X:%.*]], float [[Y:%.*]])
51475147
// APPROX-NEXT: ret float [[TMP0]]
51485148
//
51495149
extern "C" __device__ float test_float_max(float x, float y) {
@@ -5152,17 +5152,17 @@ extern "C" __device__ float test_float_max(float x, float y) {
51525152

51535153
// DEFAULT-LABEL: @test_double_min(
51545154
// DEFAULT-NEXT: entry:
5155-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5155+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
51565156
// DEFAULT-NEXT: ret double [[TMP0]]
51575157
//
51585158
// FINITEONLY-LABEL: @test_double_min(
51595159
// FINITEONLY-NEXT: entry:
5160-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5160+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
51615161
// FINITEONLY-NEXT: ret double [[TMP0]]
51625162
//
51635163
// APPROX-LABEL: @test_double_min(
51645164
// APPROX-NEXT: entry:
5165-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
5165+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.minnum.f64(double [[X:%.*]], double [[Y:%.*]])
51665166
// APPROX-NEXT: ret double [[TMP0]]
51675167
//
51685168
extern "C" __device__ double test_double_min(double x, double y) {
@@ -5171,17 +5171,17 @@ extern "C" __device__ double test_double_min(double x, double y) {
51715171

51725172
// DEFAULT-LABEL: @test_double_max(
51735173
// DEFAULT-NEXT: entry:
5174-
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5174+
// DEFAULT-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
51755175
// DEFAULT-NEXT: ret double [[TMP0]]
51765176
//
51775177
// FINITEONLY-LABEL: @test_double_max(
51785178
// FINITEONLY-NEXT: entry:
5179-
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5179+
// FINITEONLY-NEXT: [[TMP0:%.*]] = tail call nnan ninf nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
51805180
// FINITEONLY-NEXT: ret double [[TMP0]]
51815181
//
51825182
// APPROX-LABEL: @test_double_max(
51835183
// APPROX-NEXT: entry:
5184-
// APPROX-NEXT: [[TMP0:%.*]] = tail call contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
5184+
// APPROX-NEXT: [[TMP0:%.*]] = tail call nsz contract noundef double @llvm.maxnum.f64(double [[X:%.*]], double [[Y:%.*]])
51855185
// APPROX-NEXT: ret double [[TMP0]]
51865186
//
51875187
extern "C" __device__ double test_double_max(double x, double y) {

0 commit comments

Comments
 (0)