authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-28 13:11:47-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-08-28 13:11:47-07:00
logdb4fea6689eb34959028cad3b63de45da65683d3
treea35545e60b6828c72b3101143834bf3f384921b9
parent6aeab0f323ff14d7ad248e18c372573f7a5a8cd1

update libcxx, libcxxabi, and C headers to release/13.x branch

upstream commit 9c49fee5e7ac0ca8bc4ec1c3738ca0d83df65852

12 files changed, 476 insertions(+), 190 deletions(-)

lib/include/__clang_cuda_device_functions.h+174-102
......@@ -34,10 +34,12 @@ __DEVICE__ unsigned long long __brevll(unsigned long long __a) {
3434 return __nv_brevll(__a);
3535}
3636#if defined(__cplusplus)
37__DEVICE__ void __brkpt() { asm volatile("brkpt;"); }
37__DEVICE__ void __brkpt() { __asm__ __volatile__("brkpt;"); }
3838__DEVICE__ void __brkpt(int __a) { __brkpt(); }
3939#else
40__DEVICE__ void __attribute__((overloadable)) __brkpt(void) { asm volatile("brkpt;"); }
40__DEVICE__ void __attribute__((overloadable)) __brkpt(void) {
41 __asm__ __volatile__("brkpt;");
42}
4143__DEVICE__ void __attribute__((overloadable)) __brkpt(int __a) { __brkpt(); }
4244#endif
4345__DEVICE__ unsigned int __byte_perm(unsigned int __a, unsigned int __b,
......@@ -507,7 +509,7 @@ __DEVICE__ float __powf(float __a, float __b) {
507509}
508510
509511// Parameter must have a known integer value.
510#define __prof_trigger(__a) asm __volatile__("pmevent \t%0;" ::"i"(__a))
512#define __prof_trigger(__a) __asm__ __volatile__("pmevent \t%0;" ::"i"(__a))
511513__DEVICE__ int __rhadd(int __a, int __b) { return __nv_rhadd(__a, __b); }
512514__DEVICE__ unsigned int __sad(int __a, int __b, unsigned int __c) {
513515 return __nv_sad(__a, __b, __c);
......@@ -526,7 +528,7 @@ __DEVICE__ float __tanf(float __a) { return __nv_fast_tanf(__a); }
526528__DEVICE__ void __threadfence(void) { __nvvm_membar_gl(); }
527529__DEVICE__ void __threadfence_block(void) { __nvvm_membar_cta(); };
528530__DEVICE__ void __threadfence_system(void) { __nvvm_membar_sys(); };
529__DEVICE__ void __trap(void) { asm volatile("trap;"); }
531__DEVICE__ void __trap(void) { __asm__ __volatile__("trap;"); }
530532__DEVICE__ unsigned int __uAtomicAdd(unsigned int *__p, unsigned int __v) {
531533 return __nvvm_atom_add_gen_i((int *)__p, __v);
532534}
......@@ -1051,122 +1053,136 @@ __DEVICE__ unsigned int __bool2mask(unsigned int __a, int shift) {
10511053}
10521054__DEVICE__ unsigned int __vabs2(unsigned int __a) {
10531055 unsigned int r;
1054 asm("vabsdiff2.s32.s32.s32 %0,%1,%2,%3;"
1055 : "=r"(r)
1056 : "r"(__a), "r"(0), "r"(0));
1056 __asm__("vabsdiff2.s32.s32.s32 %0,%1,%2,%3;"
1057 : "=r"(r)
1058 : "r"(__a), "r"(0), "r"(0));
10571059 return r;
10581060}
10591061__DEVICE__ unsigned int __vabs4(unsigned int __a) {
10601062 unsigned int r;
1061 asm("vabsdiff4.s32.s32.s32 %0,%1,%2,%3;"
1062 : "=r"(r)
1063 : "r"(__a), "r"(0), "r"(0));
1063 __asm__("vabsdiff4.s32.s32.s32 %0,%1,%2,%3;"
1064 : "=r"(r)
1065 : "r"(__a), "r"(0), "r"(0));
10641066 return r;
10651067}
10661068__DEVICE__ unsigned int __vabsdiffs2(unsigned int __a, unsigned int __b) {
10671069 unsigned int r;
1068 asm("vabsdiff2.s32.s32.s32 %0,%1,%2,%3;"
1069 : "=r"(r)
1070 : "r"(__a), "r"(__b), "r"(0));
1070 __asm__("vabsdiff2.s32.s32.s32 %0,%1,%2,%3;"
1071 : "=r"(r)
1072 : "r"(__a), "r"(__b), "r"(0));
10711073 return r;
10721074}
10731075
10741076__DEVICE__ unsigned int __vabsdiffs4(unsigned int __a, unsigned int __b) {
10751077 unsigned int r;
1076 asm("vabsdiff4.s32.s32.s32 %0,%1,%2,%3;"
1077 : "=r"(r)
1078 : "r"(__a), "r"(__b), "r"(0));
1078 __asm__("vabsdiff4.s32.s32.s32 %0,%1,%2,%3;"
1079 : "=r"(r)
1080 : "r"(__a), "r"(__b), "r"(0));
10791081 return r;
10801082}
10811083__DEVICE__ unsigned int __vabsdiffu2(unsigned int __a, unsigned int __b) {
10821084 unsigned int r;
1083 asm("vabsdiff2.u32.u32.u32 %0,%1,%2,%3;"
1084 : "=r"(r)
1085 : "r"(__a), "r"(__b), "r"(0));
1085 __asm__("vabsdiff2.u32.u32.u32 %0,%1,%2,%3;"
1086 : "=r"(r)
1087 : "r"(__a), "r"(__b), "r"(0));
10861088 return r;
10871089}
10881090__DEVICE__ unsigned int __vabsdiffu4(unsigned int __a, unsigned int __b) {
10891091 unsigned int r;
1090 asm("vabsdiff4.u32.u32.u32 %0,%1,%2,%3;"
1091 : "=r"(r)
1092 : "r"(__a), "r"(__b), "r"(0));
1092 __asm__("vabsdiff4.u32.u32.u32 %0,%1,%2,%3;"
1093 : "=r"(r)
1094 : "r"(__a), "r"(__b), "r"(0));
10931095 return r;
10941096}
10951097__DEVICE__ unsigned int __vabsss2(unsigned int __a) {
10961098 unsigned int r;
1097 asm("vabsdiff2.s32.s32.s32.sat %0,%1,%2,%3;"
1098 : "=r"(r)
1099 : "r"(__a), "r"(0), "r"(0));
1099 __asm__("vabsdiff2.s32.s32.s32.sat %0,%1,%2,%3;"
1100 : "=r"(r)
1101 : "r"(__a), "r"(0), "r"(0));
11001102 return r;
11011103}
11021104__DEVICE__ unsigned int __vabsss4(unsigned int __a) {
11031105 unsigned int r;
1104 asm("vabsdiff4.s32.s32.s32.sat %0,%1,%2,%3;"
1105 : "=r"(r)
1106 : "r"(__a), "r"(0), "r"(0));
1106 __asm__("vabsdiff4.s32.s32.s32.sat %0,%1,%2,%3;"
1107 : "=r"(r)
1108 : "r"(__a), "r"(0), "r"(0));
11071109 return r;
11081110}
11091111__DEVICE__ unsigned int __vadd2(unsigned int __a, unsigned int __b) {
11101112 unsigned int r;
1111 asm("vadd2.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1113 __asm__("vadd2.u32.u32.u32 %0,%1,%2,%3;"
1114 : "=r"(r)
1115 : "r"(__a), "r"(__b), "r"(0));
11121116 return r;
11131117}
11141118__DEVICE__ unsigned int __vadd4(unsigned int __a, unsigned int __b) {
11151119 unsigned int r;
1116 asm("vadd4.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1120 __asm__("vadd4.u32.u32.u32 %0,%1,%2,%3;"
1121 : "=r"(r)
1122 : "r"(__a), "r"(__b), "r"(0));
11171123 return r;
11181124}
11191125__DEVICE__ unsigned int __vaddss2(unsigned int __a, unsigned int __b) {
11201126 unsigned int r;
1121 asm("vadd2.s32.s32.s32.sat %0,%1,%2,%3;"
1122 : "=r"(r)
1123 : "r"(__a), "r"(__b), "r"(0));
1127 __asm__("vadd2.s32.s32.s32.sat %0,%1,%2,%3;"
1128 : "=r"(r)
1129 : "r"(__a), "r"(__b), "r"(0));
11241130 return r;
11251131}
11261132__DEVICE__ unsigned int __vaddss4(unsigned int __a, unsigned int __b) {
11271133 unsigned int r;
1128 asm("vadd4.s32.s32.s32.sat %0,%1,%2,%3;"
1129 : "=r"(r)
1130 : "r"(__a), "r"(__b), "r"(0));
1134 __asm__("vadd4.s32.s32.s32.sat %0,%1,%2,%3;"
1135 : "=r"(r)
1136 : "r"(__a), "r"(__b), "r"(0));
11311137 return r;
11321138}
11331139__DEVICE__ unsigned int __vaddus2(unsigned int __a, unsigned int __b) {
11341140 unsigned int r;
1135 asm("vadd2.u32.u32.u32.sat %0,%1,%2,%3;"
1136 : "=r"(r)
1137 : "r"(__a), "r"(__b), "r"(0));
1141 __asm__("vadd2.u32.u32.u32.sat %0,%1,%2,%3;"
1142 : "=r"(r)
1143 : "r"(__a), "r"(__b), "r"(0));
11381144 return r;
11391145}
11401146__DEVICE__ unsigned int __vaddus4(unsigned int __a, unsigned int __b) {
11411147 unsigned int r;
1142 asm("vadd4.u32.u32.u32.sat %0,%1,%2,%3;"
1143 : "=r"(r)
1144 : "r"(__a), "r"(__b), "r"(0));
1148 __asm__("vadd4.u32.u32.u32.sat %0,%1,%2,%3;"
1149 : "=r"(r)
1150 : "r"(__a), "r"(__b), "r"(0));
11451151 return r;
11461152}
11471153__DEVICE__ unsigned int __vavgs2(unsigned int __a, unsigned int __b) {
11481154 unsigned int r;
1149 asm("vavrg2.s32.s32.s32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1155 __asm__("vavrg2.s32.s32.s32 %0,%1,%2,%3;"
1156 : "=r"(r)
1157 : "r"(__a), "r"(__b), "r"(0));
11501158 return r;
11511159}
11521160__DEVICE__ unsigned int __vavgs4(unsigned int __a, unsigned int __b) {
11531161 unsigned int r;
1154 asm("vavrg4.s32.s32.s32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1162 __asm__("vavrg4.s32.s32.s32 %0,%1,%2,%3;"
1163 : "=r"(r)
1164 : "r"(__a), "r"(__b), "r"(0));
11551165 return r;
11561166}
11571167__DEVICE__ unsigned int __vavgu2(unsigned int __a, unsigned int __b) {
11581168 unsigned int r;
1159 asm("vavrg2.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1169 __asm__("vavrg2.u32.u32.u32 %0,%1,%2,%3;"
1170 : "=r"(r)
1171 : "r"(__a), "r"(__b), "r"(0));
11601172 return r;
11611173}
11621174__DEVICE__ unsigned int __vavgu4(unsigned int __a, unsigned int __b) {
11631175 unsigned int r;
1164 asm("vavrg4.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1176 __asm__("vavrg4.u32.u32.u32 %0,%1,%2,%3;"
1177 : "=r"(r)
1178 : "r"(__a), "r"(__b), "r"(0));
11651179 return r;
11661180}
11671181__DEVICE__ unsigned int __vseteq2(unsigned int __a, unsigned int __b) {
11681182 unsigned int r;
1169 asm("vset2.u32.u32.eq %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1183 __asm__("vset2.u32.u32.eq %0,%1,%2,%3;"
1184 : "=r"(r)
1185 : "r"(__a), "r"(__b), "r"(0));
11701186 return r;
11711187}
11721188__DEVICE__ unsigned int __vcmpeq2(unsigned int __a, unsigned int __b) {
......@@ -1174,7 +1190,9 @@ __DEVICE__ unsigned int __vcmpeq2(unsigned int __a, unsigned int __b) {
11741190}
11751191__DEVICE__ unsigned int __vseteq4(unsigned int __a, unsigned int __b) {
11761192 unsigned int r;
1177 asm("vset4.u32.u32.eq %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1193 __asm__("vset4.u32.u32.eq %0,%1,%2,%3;"
1194 : "=r"(r)
1195 : "r"(__a), "r"(__b), "r"(0));
11781196 return r;
11791197}
11801198__DEVICE__ unsigned int __vcmpeq4(unsigned int __a, unsigned int __b) {
......@@ -1182,7 +1200,9 @@ __DEVICE__ unsigned int __vcmpeq4(unsigned int __a, unsigned int __b) {
11821200}
11831201__DEVICE__ unsigned int __vsetges2(unsigned int __a, unsigned int __b) {
11841202 unsigned int r;
1185 asm("vset2.s32.s32.ge %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1203 __asm__("vset2.s32.s32.ge %0,%1,%2,%3;"
1204 : "=r"(r)
1205 : "r"(__a), "r"(__b), "r"(0));
11861206 return r;
11871207}
11881208__DEVICE__ unsigned int __vcmpges2(unsigned int __a, unsigned int __b) {
......@@ -1190,7 +1210,9 @@ __DEVICE__ unsigned int __vcmpges2(unsigned int __a, unsigned int __b) {
11901210}
11911211__DEVICE__ unsigned int __vsetges4(unsigned int __a, unsigned int __b) {
11921212 unsigned int r;
1193 asm("vset4.s32.s32.ge %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1213 __asm__("vset4.s32.s32.ge %0,%1,%2,%3;"
1214 : "=r"(r)
1215 : "r"(__a), "r"(__b), "r"(0));
11941216 return r;
11951217}
11961218__DEVICE__ unsigned int __vcmpges4(unsigned int __a, unsigned int __b) {
......@@ -1198,7 +1220,9 @@ __DEVICE__ unsigned int __vcmpges4(unsigned int __a, unsigned int __b) {
11981220}
11991221__DEVICE__ unsigned int __vsetgeu2(unsigned int __a, unsigned int __b) {
12001222 unsigned int r;
1201 asm("vset2.u32.u32.ge %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1223 __asm__("vset2.u32.u32.ge %0,%1,%2,%3;"
1224 : "=r"(r)
1225 : "r"(__a), "r"(__b), "r"(0));
12021226 return r;
12031227}
12041228__DEVICE__ unsigned int __vcmpgeu2(unsigned int __a, unsigned int __b) {
......@@ -1206,7 +1230,9 @@ __DEVICE__ unsigned int __vcmpgeu2(unsigned int __a, unsigned int __b) {
12061230}
12071231__DEVICE__ unsigned int __vsetgeu4(unsigned int __a, unsigned int __b) {
12081232 unsigned int r;
1209 asm("vset4.u32.u32.ge %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1233 __asm__("vset4.u32.u32.ge %0,%1,%2,%3;"
1234 : "=r"(r)
1235 : "r"(__a), "r"(__b), "r"(0));
12101236 return r;
12111237}
12121238__DEVICE__ unsigned int __vcmpgeu4(unsigned int __a, unsigned int __b) {
......@@ -1214,7 +1240,9 @@ __DEVICE__ unsigned int __vcmpgeu4(unsigned int __a, unsigned int __b) {
12141240}
12151241__DEVICE__ unsigned int __vsetgts2(unsigned int __a, unsigned int __b) {
12161242 unsigned int r;
1217 asm("vset2.s32.s32.gt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1243 __asm__("vset2.s32.s32.gt %0,%1,%2,%3;"
1244 : "=r"(r)
1245 : "r"(__a), "r"(__b), "r"(0));
12181246 return r;
12191247}
12201248__DEVICE__ unsigned int __vcmpgts2(unsigned int __a, unsigned int __b) {
......@@ -1222,7 +1250,9 @@ __DEVICE__ unsigned int __vcmpgts2(unsigned int __a, unsigned int __b) {
12221250}
12231251__DEVICE__ unsigned int __vsetgts4(unsigned int __a, unsigned int __b) {
12241252 unsigned int r;
1225 asm("vset4.s32.s32.gt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1253 __asm__("vset4.s32.s32.gt %0,%1,%2,%3;"
1254 : "=r"(r)
1255 : "r"(__a), "r"(__b), "r"(0));
12261256 return r;
12271257}
12281258__DEVICE__ unsigned int __vcmpgts4(unsigned int __a, unsigned int __b) {
......@@ -1230,7 +1260,9 @@ __DEVICE__ unsigned int __vcmpgts4(unsigned int __a, unsigned int __b) {
12301260}
12311261__DEVICE__ unsigned int __vsetgtu2(unsigned int __a, unsigned int __b) {
12321262 unsigned int r;
1233 asm("vset2.u32.u32.gt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1263 __asm__("vset2.u32.u32.gt %0,%1,%2,%3;"
1264 : "=r"(r)
1265 : "r"(__a), "r"(__b), "r"(0));
12341266 return r;
12351267}
12361268__DEVICE__ unsigned int __vcmpgtu2(unsigned int __a, unsigned int __b) {
......@@ -1238,7 +1270,9 @@ __DEVICE__ unsigned int __vcmpgtu2(unsigned int __a, unsigned int __b) {
12381270}
12391271__DEVICE__ unsigned int __vsetgtu4(unsigned int __a, unsigned int __b) {
12401272 unsigned int r;
1241 asm("vset4.u32.u32.gt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1273 __asm__("vset4.u32.u32.gt %0,%1,%2,%3;"
1274 : "=r"(r)
1275 : "r"(__a), "r"(__b), "r"(0));
12421276 return r;
12431277}
12441278__DEVICE__ unsigned int __vcmpgtu4(unsigned int __a, unsigned int __b) {
......@@ -1246,7 +1280,9 @@ __DEVICE__ unsigned int __vcmpgtu4(unsigned int __a, unsigned int __b) {
12461280}
12471281__DEVICE__ unsigned int __vsetles2(unsigned int __a, unsigned int __b) {
12481282 unsigned int r;
1249 asm("vset2.s32.s32.le %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1283 __asm__("vset2.s32.s32.le %0,%1,%2,%3;"
1284 : "=r"(r)
1285 : "r"(__a), "r"(__b), "r"(0));
12501286 return r;
12511287}
12521288__DEVICE__ unsigned int __vcmples2(unsigned int __a, unsigned int __b) {
......@@ -1254,7 +1290,9 @@ __DEVICE__ unsigned int __vcmples2(unsigned int __a, unsigned int __b) {
12541290}
12551291__DEVICE__ unsigned int __vsetles4(unsigned int __a, unsigned int __b) {
12561292 unsigned int r;
1257 asm("vset4.s32.s32.le %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1293 __asm__("vset4.s32.s32.le %0,%1,%2,%3;"
1294 : "=r"(r)
1295 : "r"(__a), "r"(__b), "r"(0));
12581296 return r;
12591297}
12601298__DEVICE__ unsigned int __vcmples4(unsigned int __a, unsigned int __b) {
......@@ -1262,7 +1300,9 @@ __DEVICE__ unsigned int __vcmples4(unsigned int __a, unsigned int __b) {
12621300}
12631301__DEVICE__ unsigned int __vsetleu2(unsigned int __a, unsigned int __b) {
12641302 unsigned int r;
1265 asm("vset2.u32.u32.le %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1303 __asm__("vset2.u32.u32.le %0,%1,%2,%3;"
1304 : "=r"(r)
1305 : "r"(__a), "r"(__b), "r"(0));
12661306 return r;
12671307}
12681308__DEVICE__ unsigned int __vcmpleu2(unsigned int __a, unsigned int __b) {
......@@ -1270,7 +1310,9 @@ __DEVICE__ unsigned int __vcmpleu2(unsigned int __a, unsigned int __b) {
12701310}
12711311__DEVICE__ unsigned int __vsetleu4(unsigned int __a, unsigned int __b) {
12721312 unsigned int r;
1273 asm("vset4.u32.u32.le %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1313 __asm__("vset4.u32.u32.le %0,%1,%2,%3;"
1314 : "=r"(r)
1315 : "r"(__a), "r"(__b), "r"(0));
12741316 return r;
12751317}
12761318__DEVICE__ unsigned int __vcmpleu4(unsigned int __a, unsigned int __b) {
......@@ -1278,7 +1320,9 @@ __DEVICE__ unsigned int __vcmpleu4(unsigned int __a, unsigned int __b) {
12781320}
12791321__DEVICE__ unsigned int __vsetlts2(unsigned int __a, unsigned int __b) {
12801322 unsigned int r;
1281 asm("vset2.s32.s32.lt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1323 __asm__("vset2.s32.s32.lt %0,%1,%2,%3;"
1324 : "=r"(r)
1325 : "r"(__a), "r"(__b), "r"(0));
12821326 return r;
12831327}
12841328__DEVICE__ unsigned int __vcmplts2(unsigned int __a, unsigned int __b) {
......@@ -1286,7 +1330,9 @@ __DEVICE__ unsigned int __vcmplts2(unsigned int __a, unsigned int __b) {
12861330}
12871331__DEVICE__ unsigned int __vsetlts4(unsigned int __a, unsigned int __b) {
12881332 unsigned int r;
1289 asm("vset4.s32.s32.lt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1333 __asm__("vset4.s32.s32.lt %0,%1,%2,%3;"
1334 : "=r"(r)
1335 : "r"(__a), "r"(__b), "r"(0));
12901336 return r;
12911337}
12921338__DEVICE__ unsigned int __vcmplts4(unsigned int __a, unsigned int __b) {
......@@ -1294,7 +1340,9 @@ __DEVICE__ unsigned int __vcmplts4(unsigned int __a, unsigned int __b) {
12941340}
12951341__DEVICE__ unsigned int __vsetltu2(unsigned int __a, unsigned int __b) {
12961342 unsigned int r;
1297 asm("vset2.u32.u32.lt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1343 __asm__("vset2.u32.u32.lt %0,%1,%2,%3;"
1344 : "=r"(r)
1345 : "r"(__a), "r"(__b), "r"(0));
12981346 return r;
12991347}
13001348__DEVICE__ unsigned int __vcmpltu2(unsigned int __a, unsigned int __b) {
......@@ -1302,7 +1350,9 @@ __DEVICE__ unsigned int __vcmpltu2(unsigned int __a, unsigned int __b) {
13021350}
13031351__DEVICE__ unsigned int __vsetltu4(unsigned int __a, unsigned int __b) {
13041352 unsigned int r;
1305 asm("vset4.u32.u32.lt %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1353 __asm__("vset4.u32.u32.lt %0,%1,%2,%3;"
1354 : "=r"(r)
1355 : "r"(__a), "r"(__b), "r"(0));
13061356 return r;
13071357}
13081358__DEVICE__ unsigned int __vcmpltu4(unsigned int __a, unsigned int __b) {
......@@ -1310,7 +1360,9 @@ __DEVICE__ unsigned int __vcmpltu4(unsigned int __a, unsigned int __b) {
13101360}
13111361__DEVICE__ unsigned int __vsetne2(unsigned int __a, unsigned int __b) {
13121362 unsigned int r;
1313 asm("vset2.u32.u32.ne %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1363 __asm__("vset2.u32.u32.ne %0,%1,%2,%3;"
1364 : "=r"(r)
1365 : "r"(__a), "r"(__b), "r"(0));
13141366 return r;
13151367}
13161368__DEVICE__ unsigned int __vcmpne2(unsigned int __a, unsigned int __b) {
......@@ -1318,7 +1370,9 @@ __DEVICE__ unsigned int __vcmpne2(unsigned int __a, unsigned int __b) {
13181370}
13191371__DEVICE__ unsigned int __vsetne4(unsigned int __a, unsigned int __b) {
13201372 unsigned int r;
1321 asm("vset4.u32.u32.ne %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1373 __asm__("vset4.u32.u32.ne %0,%1,%2,%3;"
1374 : "=r"(r)
1375 : "r"(__a), "r"(__b), "r"(0));
13221376 return r;
13231377}
13241378__DEVICE__ unsigned int __vcmpne4(unsigned int __a, unsigned int __b) {
......@@ -1345,94 +1399,112 @@ __DEVICE__ unsigned int __vmaxs2(unsigned int __a, unsigned int __b) {
13451399 unsigned mask = __vcmpgts2(__a, __b);
13461400 r = (__a & mask) | (__b & ~mask);
13471401 } else {
1348 asm("vmax2.s32.s32.s32 %0,%1,%2,%3;"
1349 : "=r"(r)
1350 : "r"(__a), "r"(__b), "r"(0));
1402 __asm__("vmax2.s32.s32.s32 %0,%1,%2,%3;"
1403 : "=r"(r)
1404 : "r"(__a), "r"(__b), "r"(0));
13511405 }
13521406 return r;
13531407}
13541408__DEVICE__ unsigned int __vmaxs4(unsigned int __a, unsigned int __b) {
13551409 unsigned int r;
1356 asm("vmax4.s32.s32.s32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1410 __asm__("vmax4.s32.s32.s32 %0,%1,%2,%3;"
1411 : "=r"(r)
1412 : "r"(__a), "r"(__b), "r"(0));
13571413 return r;
13581414}
13591415__DEVICE__ unsigned int __vmaxu2(unsigned int __a, unsigned int __b) {
13601416 unsigned int r;
1361 asm("vmax2.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1417 __asm__("vmax2.u32.u32.u32 %0,%1,%2,%3;"
1418 : "=r"(r)
1419 : "r"(__a), "r"(__b), "r"(0));
13621420 return r;
13631421}
13641422__DEVICE__ unsigned int __vmaxu4(unsigned int __a, unsigned int __b) {
13651423 unsigned int r;
1366 asm("vmax4.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1424 __asm__("vmax4.u32.u32.u32 %0,%1,%2,%3;"
1425 : "=r"(r)
1426 : "r"(__a), "r"(__b), "r"(0));
13671427 return r;
13681428}
13691429__DEVICE__ unsigned int __vmins2(unsigned int __a, unsigned int __b) {
13701430 unsigned int r;
1371 asm("vmin2.s32.s32.s32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1431 __asm__("vmin2.s32.s32.s32 %0,%1,%2,%3;"
1432 : "=r"(r)
1433 : "r"(__a), "r"(__b), "r"(0));
13721434 return r;
13731435}
13741436__DEVICE__ unsigned int __vmins4(unsigned int __a, unsigned int __b) {
13751437 unsigned int r;
1376 asm("vmin4.s32.s32.s32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1438 __asm__("vmin4.s32.s32.s32 %0,%1,%2,%3;"
1439 : "=r"(r)
1440 : "r"(__a), "r"(__b), "r"(0));
13771441 return r;
13781442}
13791443__DEVICE__ unsigned int __vminu2(unsigned int __a, unsigned int __b) {
13801444 unsigned int r;
1381 asm("vmin2.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1445 __asm__("vmin2.u32.u32.u32 %0,%1,%2,%3;"
1446 : "=r"(r)
1447 : "r"(__a), "r"(__b), "r"(0));
13821448 return r;
13831449}
13841450__DEVICE__ unsigned int __vminu4(unsigned int __a, unsigned int __b) {
13851451 unsigned int r;
1386 asm("vmin4.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1452 __asm__("vmin4.u32.u32.u32 %0,%1,%2,%3;"
1453 : "=r"(r)
1454 : "r"(__a), "r"(__b), "r"(0));
13871455 return r;
13881456}
13891457__DEVICE__ unsigned int __vsads2(unsigned int __a, unsigned int __b) {
13901458 unsigned int r;
1391 asm("vabsdiff2.s32.s32.s32.add %0,%1,%2,%3;"
1392 : "=r"(r)
1393 : "r"(__a), "r"(__b), "r"(0));
1459 __asm__("vabsdiff2.s32.s32.s32.add %0,%1,%2,%3;"
1460 : "=r"(r)
1461 : "r"(__a), "r"(__b), "r"(0));
13941462 return r;
13951463}
13961464__DEVICE__ unsigned int __vsads4(unsigned int __a, unsigned int __b) {
13971465 unsigned int r;
1398 asm("vabsdiff4.s32.s32.s32.add %0,%1,%2,%3;"
1399 : "=r"(r)
1400 : "r"(__a), "r"(__b), "r"(0));
1466 __asm__("vabsdiff4.s32.s32.s32.add %0,%1,%2,%3;"
1467 : "=r"(r)
1468 : "r"(__a), "r"(__b), "r"(0));
14011469 return r;
14021470}
14031471__DEVICE__ unsigned int __vsadu2(unsigned int __a, unsigned int __b) {
14041472 unsigned int r;
1405 asm("vabsdiff2.u32.u32.u32.add %0,%1,%2,%3;"
1406 : "=r"(r)
1407 : "r"(__a), "r"(__b), "r"(0));
1473 __asm__("vabsdiff2.u32.u32.u32.add %0,%1,%2,%3;"
1474 : "=r"(r)
1475 : "r"(__a), "r"(__b), "r"(0));
14081476 return r;
14091477}
14101478__DEVICE__ unsigned int __vsadu4(unsigned int __a, unsigned int __b) {
14111479 unsigned int r;
1412 asm("vabsdiff4.u32.u32.u32.add %0,%1,%2,%3;"
1413 : "=r"(r)
1414 : "r"(__a), "r"(__b), "r"(0));
1480 __asm__("vabsdiff4.u32.u32.u32.add %0,%1,%2,%3;"
1481 : "=r"(r)
1482 : "r"(__a), "r"(__b), "r"(0));
14151483 return r;
14161484}
14171485
14181486__DEVICE__ unsigned int __vsub2(unsigned int __a, unsigned int __b) {
14191487 unsigned int r;
1420 asm("vsub2.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1488 __asm__("vsub2.u32.u32.u32 %0,%1,%2,%3;"
1489 : "=r"(r)
1490 : "r"(__a), "r"(__b), "r"(0));
14211491 return r;
14221492}
14231493__DEVICE__ unsigned int __vneg2(unsigned int __a) { return __vsub2(0, __a); }
14241494
14251495__DEVICE__ unsigned int __vsub4(unsigned int __a, unsigned int __b) {
14261496 unsigned int r;
1427 asm("vsub4.u32.u32.u32 %0,%1,%2,%3;" : "=r"(r) : "r"(__a), "r"(__b), "r"(0));
1497 __asm__("vsub4.u32.u32.u32 %0,%1,%2,%3;"
1498 : "=r"(r)
1499 : "r"(__a), "r"(__b), "r"(0));
14281500 return r;
14291501}
14301502__DEVICE__ unsigned int __vneg4(unsigned int __a) { return __vsub4(0, __a); }
14311503__DEVICE__ unsigned int __vsubss2(unsigned int __a, unsigned int __b) {
14321504 unsigned int r;
1433 asm("vsub2.s32.s32.s32.sat %0,%1,%2,%3;"
1434 : "=r"(r)
1435 : "r"(__a), "r"(__b), "r"(0));
1505 __asm__("vsub2.s32.s32.s32.sat %0,%1,%2,%3;"
1506 : "=r"(r)
1507 : "r"(__a), "r"(__b), "r"(0));
14361508 return r;
14371509}
14381510__DEVICE__ unsigned int __vnegss2(unsigned int __a) {
......@@ -1440,9 +1512,9 @@ __DEVICE__ unsigned int __vnegss2(unsigned int __a) {
14401512}
14411513__DEVICE__ unsigned int __vsubss4(unsigned int __a, unsigned int __b) {
14421514 unsigned int r;
1443 asm("vsub4.s32.s32.s32.sat %0,%1,%2,%3;"
1444 : "=r"(r)
1445 : "r"(__a), "r"(__b), "r"(0));
1515 __asm__("vsub4.s32.s32.s32.sat %0,%1,%2,%3;"
1516 : "=r"(r)
1517 : "r"(__a), "r"(__b), "r"(0));
14461518 return r;
14471519}
14481520__DEVICE__ unsigned int __vnegss4(unsigned int __a) {
......@@ -1450,16 +1522,16 @@ __DEVICE__ unsigned int __vnegss4(unsigned int __a) {
14501522}
14511523__DEVICE__ unsigned int __vsubus2(unsigned int __a, unsigned int __b) {
14521524 unsigned int r;
1453 asm("vsub2.u32.u32.u32.sat %0,%1,%2,%3;"
1454 : "=r"(r)
1455 : "r"(__a), "r"(__b), "r"(0));
1525 __asm__("vsub2.u32.u32.u32.sat %0,%1,%2,%3;"
1526 : "=r"(r)
1527 : "r"(__a), "r"(__b), "r"(0));
14561528 return r;
14571529}
14581530__DEVICE__ unsigned int __vsubus4(unsigned int __a, unsigned int __b) {
14591531 unsigned int r;
1460 asm("vsub4.u32.u32.u32.sat %0,%1,%2,%3;"
1461 : "=r"(r)
1462 : "r"(__a), "r"(__b), "r"(0));
1532 __asm__("vsub4.u32.u32.u32.sat %0,%1,%2,%3;"
1533 : "=r"(r)
1534 : "r"(__a), "r"(__b), "r"(0));
14631535 return r;
14641536}
14651537#endif // CUDA_VERSION >= 9020
lib/include/__clang_hip_cmath.h+110-78
......@@ -10,7 +10,7 @@
1010#ifndef __CLANG_HIP_CMATH_H__
1111#define __CLANG_HIP_CMATH_H__
1212
13#if !defined(__HIP__)
13#if !defined(__HIP__) && !defined(__OPENMP_AMDGCN__)
1414#error "This file is for HIP and OpenMP AMDGCN device compilation only."
1515#endif
1616
......@@ -25,31 +25,43 @@
2525#endif // !defined(__HIPCC_RTC__)
2626
2727#pragma push_macro("__DEVICE__")
28#pragma push_macro("__CONSTEXPR__")
29#ifdef __OPENMP_AMDGCN__
30#define __DEVICE__ static __attribute__((always_inline, nothrow))
31#define __CONSTEXPR__ constexpr
32#else
2833#define __DEVICE__ static __device__ inline __attribute__((always_inline))
34#define __CONSTEXPR__
35#endif // __OPENMP_AMDGCN__
2936
3037// Start with functions that cannot be defined by DEF macros below.
3138#if defined(__cplusplus)
32__DEVICE__ double abs(double __x) { return ::fabs(__x); }
33__DEVICE__ float abs(float __x) { return ::fabsf(__x); }
34__DEVICE__ long long abs(long long __n) { return ::llabs(__n); }
35__DEVICE__ long abs(long __n) { return ::labs(__n); }
36__DEVICE__ float fma(float __x, float __y, float __z) {
39#if defined __OPENMP_AMDGCN__
40__DEVICE__ __CONSTEXPR__ float fabs(float __x) { return ::fabsf(__x); }
41__DEVICE__ __CONSTEXPR__ float sin(float __x) { return ::sinf(__x); }
42__DEVICE__ __CONSTEXPR__ float cos(float __x) { return ::cosf(__x); }
43#endif
44__DEVICE__ __CONSTEXPR__ double abs(double __x) { return ::fabs(__x); }
45__DEVICE__ __CONSTEXPR__ float abs(float __x) { return ::fabsf(__x); }
46__DEVICE__ __CONSTEXPR__ long long abs(long long __n) { return ::llabs(__n); }
47__DEVICE__ __CONSTEXPR__ long abs(long __n) { return ::labs(__n); }
48__DEVICE__ __CONSTEXPR__ float fma(float __x, float __y, float __z) {
3749 return ::fmaf(__x, __y, __z);
3850}
3951#if !defined(__HIPCC_RTC__)
4052// The value returned by fpclassify is platform dependent, therefore it is not
4153// supported by hipRTC.
42__DEVICE__ int fpclassify(float __x) {
54__DEVICE__ __CONSTEXPR__ int fpclassify(float __x) {
4355 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
4456 FP_ZERO, __x);
4557}
46__DEVICE__ int fpclassify(double __x) {
58__DEVICE__ __CONSTEXPR__ int fpclassify(double __x) {
4759 return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL,
4860 FP_ZERO, __x);
4961}
5062#endif // !defined(__HIPCC_RTC__)
5163
52__DEVICE__ float frexp(float __arg, int *__exp) {
64__DEVICE__ __CONSTEXPR__ float frexp(float __arg, int *__exp) {
5365 return ::frexpf(__arg, __exp);
5466}
5567
......@@ -71,93 +83,101 @@ __DEVICE__ float frexp(float __arg, int *__exp) {
7183// of the variants inside the inner region and avoid the clash.
7284#pragma omp begin declare variant match(implementation = {vendor(llvm)})
7385
74__DEVICE__ int isinf(float __x) { return ::__isinff(__x); }
75__DEVICE__ int isinf(double __x) { return ::__isinf(__x); }
76__DEVICE__ int isfinite(float __x) { return ::__finitef(__x); }
77__DEVICE__ int isfinite(double __x) { return ::__finite(__x); }
78__DEVICE__ int isnan(float __x) { return ::__isnanf(__x); }
79__DEVICE__ int isnan(double __x) { return ::__isnan(__x); }
86__DEVICE__ __CONSTEXPR__ int isinf(float __x) { return ::__isinff(__x); }
87__DEVICE__ __CONSTEXPR__ int isinf(double __x) { return ::__isinf(__x); }
88__DEVICE__ __CONSTEXPR__ int isfinite(float __x) { return ::__finitef(__x); }
89__DEVICE__ __CONSTEXPR__ int isfinite(double __x) { return ::__finite(__x); }
90__DEVICE__ __CONSTEXPR__ int isnan(float __x) { return ::__isnanf(__x); }
91__DEVICE__ __CONSTEXPR__ int isnan(double __x) { return ::__isnan(__x); }
8092
8193#pragma omp end declare variant
8294#endif // defined(__OPENMP_AMDGCN__)
8395
84__DEVICE__ bool isinf(float __x) { return ::__isinff(__x); }
85__DEVICE__ bool isinf(double __x) { return ::__isinf(__x); }
86__DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); }
87__DEVICE__ bool isfinite(double __x) { return ::__finite(__x); }
88__DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); }
89__DEVICE__ bool isnan(double __x) { return ::__isnan(__x); }
96__DEVICE__ __CONSTEXPR__ bool isinf(float __x) { return ::__isinff(__x); }
97__DEVICE__ __CONSTEXPR__ bool isinf(double __x) { return ::__isinf(__x); }
98__DEVICE__ __CONSTEXPR__ bool isfinite(float __x) { return ::__finitef(__x); }
99__DEVICE__ __CONSTEXPR__ bool isfinite(double __x) { return ::__finite(__x); }
100__DEVICE__ __CONSTEXPR__ bool isnan(float __x) { return ::__isnanf(__x); }
101__DEVICE__ __CONSTEXPR__ bool isnan(double __x) { return ::__isnan(__x); }
90102
91103#if defined(__OPENMP_AMDGCN__)
92104#pragma omp end declare variant
93105#endif // defined(__OPENMP_AMDGCN__)
94106
95__DEVICE__ bool isgreater(float __x, float __y) {
107__DEVICE__ __CONSTEXPR__ bool isgreater(float __x, float __y) {
96108 return __builtin_isgreater(__x, __y);
97109}
98__DEVICE__ bool isgreater(double __x, double __y) {
110__DEVICE__ __CONSTEXPR__ bool isgreater(double __x, double __y) {
99111 return __builtin_isgreater(__x, __y);
100112}
101__DEVICE__ bool isgreaterequal(float __x, float __y) {
113__DEVICE__ __CONSTEXPR__ bool isgreaterequal(float __x, float __y) {
102114 return __builtin_isgreaterequal(__x, __y);
103115}
104__DEVICE__ bool isgreaterequal(double __x, double __y) {
116__DEVICE__ __CONSTEXPR__ bool isgreaterequal(double __x, double __y) {
105117 return __builtin_isgreaterequal(__x, __y);
106118}
107__DEVICE__ bool isless(float __x, float __y) {
119__DEVICE__ __CONSTEXPR__ bool isless(float __x, float __y) {
108120 return __builtin_isless(__x, __y);
109121}
110__DEVICE__ bool isless(double __x, double __y) {
122__DEVICE__ __CONSTEXPR__ bool isless(double __x, double __y) {
111123 return __builtin_isless(__x, __y);
112124}
113__DEVICE__ bool islessequal(float __x, float __y) {
125__DEVICE__ __CONSTEXPR__ bool islessequal(float __x, float __y) {
114126 return __builtin_islessequal(__x, __y);
115127}
116__DEVICE__ bool islessequal(double __x, double __y) {
128__DEVICE__ __CONSTEXPR__ bool islessequal(double __x, double __y) {
117129 return __builtin_islessequal(__x, __y);
118130}
119__DEVICE__ bool islessgreater(float __x, float __y) {
131__DEVICE__ __CONSTEXPR__ bool islessgreater(float __x, float __y) {
120132 return __builtin_islessgreater(__x, __y);
121133}
122__DEVICE__ bool islessgreater(double __x, double __y) {
134__DEVICE__ __CONSTEXPR__ bool islessgreater(double __x, double __y) {
123135 return __builtin_islessgreater(__x, __y);
124136}
125__DEVICE__ bool isnormal(float __x) { return __builtin_isnormal(__x); }
126__DEVICE__ bool isnormal(double __x) { return __builtin_isnormal(__x); }
127__DEVICE__ bool isunordered(float __x, float __y) {
137__DEVICE__ __CONSTEXPR__ bool isnormal(float __x) {
138 return __builtin_isnormal(__x);
139}
140__DEVICE__ __CONSTEXPR__ bool isnormal(double __x) {
141 return __builtin_isnormal(__x);
142}
143__DEVICE__ __CONSTEXPR__ bool isunordered(float __x, float __y) {
128144 return __builtin_isunordered(__x, __y);
129145}
130__DEVICE__ bool isunordered(double __x, double __y) {
146__DEVICE__ __CONSTEXPR__ bool isunordered(double __x, double __y) {
131147 return __builtin_isunordered(__x, __y);
132148}
133__DEVICE__ float modf(float __x, float *__iptr) { return ::modff(__x, __iptr); }
134__DEVICE__ float pow(float __base, int __iexp) {
149__DEVICE__ __CONSTEXPR__ float modf(float __x, float *__iptr) {
150 return ::modff(__x, __iptr);
151}
152__DEVICE__ __CONSTEXPR__ float pow(float __base, int __iexp) {
135153 return ::powif(__base, __iexp);
136154}
137__DEVICE__ double pow(double __base, int __iexp) {
155__DEVICE__ __CONSTEXPR__ double pow(double __base, int __iexp) {
138156 return ::powi(__base, __iexp);
139157}
140__DEVICE__ float remquo(float __x, float __y, int *__quo) {
158__DEVICE__ __CONSTEXPR__ float remquo(float __x, float __y, int *__quo) {
141159 return ::remquof(__x, __y, __quo);
142160}
143__DEVICE__ float scalbln(float __x, long int __n) {
161__DEVICE__ __CONSTEXPR__ float scalbln(float __x, long int __n) {
144162 return ::scalblnf(__x, __n);
145163}
146__DEVICE__ bool signbit(float __x) { return ::__signbitf(__x); }
147__DEVICE__ bool signbit(double __x) { return ::__signbit(__x); }
164__DEVICE__ __CONSTEXPR__ bool signbit(float __x) { return ::__signbitf(__x); }
165__DEVICE__ __CONSTEXPR__ bool signbit(double __x) { return ::__signbit(__x); }
148166
149167// Notably missing above is nexttoward. We omit it because
150168// ocml doesn't provide an implementation, and we don't want to be in the
151169// business of implementing tricky libm functions in this header.
152170
153171// Other functions.
154__DEVICE__ _Float16 fma(_Float16 __x, _Float16 __y, _Float16 __z) {
172__DEVICE__ __CONSTEXPR__ _Float16 fma(_Float16 __x, _Float16 __y,
173 _Float16 __z) {
155174 return __ocml_fma_f16(__x, __y, __z);
156175}
157__DEVICE__ _Float16 pow(_Float16 __base, int __iexp) {
176__DEVICE__ __CONSTEXPR__ _Float16 pow(_Float16 __base, int __iexp) {
158177 return __ocml_pown_f16(__base, __iexp);
159178}
160179
180#ifndef __OPENMP_AMDGCN__
161181// BEGIN DEF_FUN and HIP_OVERLOAD
162182
163183// BEGIN DEF_FUN
......@@ -168,18 +188,19 @@ __DEVICE__ _Float16 pow(_Float16 __base, int __iexp) {
168188
169189// Define cmath functions with float argument and returns __retty.
170190#define __DEF_FUN1(__retty, __func) \
171 __DEVICE__ \
172 __retty __func(float __x) { return __func##f(__x); }
191 __DEVICE__ __CONSTEXPR__ __retty __func(float __x) { return __func##f(__x); }
173192
174193// Define cmath functions with two float arguments and returns __retty.
175194#define __DEF_FUN2(__retty, __func) \
176 __DEVICE__ \
177 __retty __func(float __x, float __y) { return __func##f(__x, __y); }
195 __DEVICE__ __CONSTEXPR__ __retty __func(float __x, float __y) { \
196 return __func##f(__x, __y); \
197 }
178198
179199// Define cmath functions with a float and an int argument and returns __retty.
180200#define __DEF_FUN2_FI(__retty, __func) \
181 __DEVICE__ \
182 __retty __func(float __x, int __y) { return __func##f(__x, __y); }
201 __DEVICE__ __CONSTEXPR__ __retty __func(float __x, int __y) { \
202 return __func##f(__x, __y); \
203 }
183204
184205__DEF_FUN1(float, acos)
185206__DEF_FUN1(float, acosh)
......@@ -426,7 +447,7 @@ class __promote : public __promote_imp<_A1, _A2, _A3> {};
426447// floor(double).
427448#define __HIP_OVERLOAD1(__retty, __fn) \
428449 template <typename __T> \
429 __DEVICE__ \
450 __DEVICE__ __CONSTEXPR__ \
430451 typename __hip_enable_if<__hip::is_integral<__T>::value, __retty>::type \
431452 __fn(__T __x) { \
432453 return ::__fn((double)__x); \
......@@ -438,7 +459,7 @@ class __promote : public __promote_imp<_A1, _A2, _A3> {};
438459#if __cplusplus >= 201103L
439460#define __HIP_OVERLOAD2(__retty, __fn) \
440461 template <typename __T1, typename __T2> \
441 __DEVICE__ typename __hip_enable_if< \
462 __DEVICE__ __CONSTEXPR__ typename __hip_enable_if< \
442463 __hip::is_arithmetic<__T1>::value && __hip::is_arithmetic<__T2>::value, \
443464 typename __hip::__promote<__T1, __T2>::type>::type \
444465 __fn(__T1 __x, __T2 __y) { \
......@@ -448,10 +469,11 @@ class __promote : public __promote_imp<_A1, _A2, _A3> {};
448469#else
449470#define __HIP_OVERLOAD2(__retty, __fn) \
450471 template <typename __T1, typename __T2> \
451 __DEVICE__ typename __hip_enable_if<__hip::is_arithmetic<__T1>::value && \
452 __hip::is_arithmetic<__T2>::value, \
453 __retty>::type \
454 __fn(__T1 __x, __T2 __y) { \
472 __DEVICE__ __CONSTEXPR__ \
473 typename __hip_enable_if<__hip::is_arithmetic<__T1>::value && \
474 __hip::is_arithmetic<__T2>::value, \
475 __retty>::type \
476 __fn(__T1 __x, __T2 __y) { \
455477 return __fn((double)__x, (double)__y); \
456478 }
457479#endif
......@@ -526,7 +548,7 @@ __HIP_OVERLOAD2(double, min)
526548// Additional Overloads that don't quite match HIP_OVERLOAD.
527549#if __cplusplus >= 201103L
528550template <typename __T1, typename __T2, typename __T3>
529__DEVICE__ typename __hip_enable_if<
551__DEVICE__ __CONSTEXPR__ typename __hip_enable_if<
530552 __hip::is_arithmetic<__T1>::value && __hip::is_arithmetic<__T2>::value &&
531553 __hip::is_arithmetic<__T3>::value,
532554 typename __hip::__promote<__T1, __T2, __T3>::type>::type
......@@ -536,31 +558,32 @@ fma(__T1 __x, __T2 __y, __T3 __z) {
536558}
537559#else
538560template <typename __T1, typename __T2, typename __T3>
539__DEVICE__ typename __hip_enable_if<__hip::is_arithmetic<__T1>::value &&
540 __hip::is_arithmetic<__T2>::value &&
541 __hip::is_arithmetic<__T3>::value,
542 double>::type
543fma(__T1 __x, __T2 __y, __T3 __z) {
561__DEVICE__ __CONSTEXPR__
562 typename __hip_enable_if<__hip::is_arithmetic<__T1>::value &&
563 __hip::is_arithmetic<__T2>::value &&
564 __hip::is_arithmetic<__T3>::value,
565 double>::type
566 fma(__T1 __x, __T2 __y, __T3 __z) {
544567 return ::fma((double)__x, (double)__y, (double)__z);
545568}
546569#endif
547570
548571template <typename __T>
549__DEVICE__
572__DEVICE__ __CONSTEXPR__
550573 typename __hip_enable_if<__hip::is_integral<__T>::value, double>::type
551574 frexp(__T __x, int *__exp) {
552575 return ::frexp((double)__x, __exp);
553576}
554577
555578template <typename __T>
556__DEVICE__
579__DEVICE__ __CONSTEXPR__
557580 typename __hip_enable_if<__hip::is_integral<__T>::value, double>::type
558581 ldexp(__T __x, int __exp) {
559582 return ::ldexp((double)__x, __exp);
560583}
561584
562585template <typename __T>
563__DEVICE__
586__DEVICE__ __CONSTEXPR__
564587 typename __hip_enable_if<__hip::is_integral<__T>::value, double>::type
565588 modf(__T __x, double *__exp) {
566589 return ::modf((double)__x, __exp);
......@@ -568,7 +591,7 @@ __DEVICE__
568591
569592#if __cplusplus >= 201103L
570593template <typename __T1, typename __T2>
571__DEVICE__
594__DEVICE__ __CONSTEXPR__
572595 typename __hip_enable_if<__hip::is_arithmetic<__T1>::value &&
573596 __hip::is_arithmetic<__T2>::value,
574597 typename __hip::__promote<__T1, __T2>::type>::type
......@@ -578,23 +601,24 @@ __DEVICE__
578601}
579602#else
580603template <typename __T1, typename __T2>
581__DEVICE__ typename __hip_enable_if<__hip::is_arithmetic<__T1>::value &&
582 __hip::is_arithmetic<__T2>::value,
583 double>::type
584remquo(__T1 __x, __T2 __y, int *__quo) {
604__DEVICE__ __CONSTEXPR__
605 typename __hip_enable_if<__hip::is_arithmetic<__T1>::value &&
606 __hip::is_arithmetic<__T2>::value,
607 double>::type
608 remquo(__T1 __x, __T2 __y, int *__quo) {
585609 return ::remquo((double)__x, (double)__y, __quo);
586610}
587611#endif
588612
589613template <typename __T>
590__DEVICE__
614__DEVICE__ __CONSTEXPR__
591615 typename __hip_enable_if<__hip::is_integral<__T>::value, double>::type
592616 scalbln(__T __x, long int __exp) {
593617 return ::scalbln((double)__x, __exp);
594618}
595619
596620template <typename __T>
597__DEVICE__
621__DEVICE__ __CONSTEXPR__
598622 typename __hip_enable_if<__hip::is_integral<__T>::value, double>::type
599623 scalbn(__T __x, int __exp) {
600624 return ::scalbn((double)__x, __exp);
......@@ -607,8 +631,10 @@ __DEVICE__
607631
608632// END DEF_FUN and HIP_OVERLOAD
609633
634#endif // ifndef __OPENMP_AMDGCN__
610635#endif // defined(__cplusplus)
611636
637#ifndef __OPENMP_AMDGCN__
612638// Define these overloads inside the namespace our standard library uses.
613639#if !defined(__HIPCC_RTC__)
614640#ifdef _LIBCPP_BEGIN_NAMESPACE_STD
......@@ -781,22 +807,26 @@ _GLIBCXX_END_NAMESPACE_VERSION
781807#if defined(__cplusplus)
782808extern "C" {
783809#endif // defined(__cplusplus)
784__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
810__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) double _Cosh(double x,
811 double y) {
785812 return cosh(x) * y;
786813}
787__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
814__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) float _FCosh(float x,
815 float y) {
788816 return coshf(x) * y;
789817}
790__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
818__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) short _Dtest(double *p) {
791819 return fpclassify(*p);
792820}
793__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
821__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) short _FDtest(float *p) {
794822 return fpclassify(*p);
795823}
796__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
824__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) double _Sinh(double x,
825 double y) {
797826 return sinh(x) * y;
798827}
799__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
828__DEVICE__ __CONSTEXPR__ __attribute__((overloadable)) float _FSinh(float x,
829 float y) {
800830 return sinhf(x) * y;
801831}
802832#if defined(__cplusplus)
......@@ -804,7 +834,9 @@ __DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
804834#endif // defined(__cplusplus)
805835#endif // defined(_MSC_VER)
806836#endif // !defined(__HIPCC_RTC__)
837#endif // ifndef __OPENMP_AMDGCN__
807838
808839#pragma pop_macro("__DEVICE__")
840#pragma pop_macro("__CONSTEXPR__")
809841
810842#endif // __CLANG_HIP_CMATH_H__
lib/include/__clang_hip_math.h+46-4
......@@ -9,7 +9,7 @@
99#ifndef __CLANG_HIP_MATH_H__
1010#define __CLANG_HIP_MATH_H__
1111
12#if !defined(__HIP__)
12#if !defined(__HIP__) && !defined(__OPENMP_AMDGCN__)
1313#error "This file is for HIP and OpenMP AMDGCN device compilation only."
1414#endif
1515
......@@ -19,18 +19,30 @@
1919#endif
2020#include <limits.h>
2121#include <stdint.h>
22#endif // __HIPCC_RTC__
22#ifdef __OPENMP_AMDGCN__
23#include <omp.h>
24#endif
25#endif // !defined(__HIPCC_RTC__)
2326
2427#pragma push_macro("__DEVICE__")
28
29#ifdef __OPENMP_AMDGCN__
30#define __DEVICE__ static inline __attribute__((always_inline, nothrow))
31#else
2532#define __DEVICE__ static __device__ inline __attribute__((always_inline))
33#endif
2634
2735// A few functions return bool type starting only in C++11.
2836#pragma push_macro("__RETURN_TYPE")
37#ifdef __OPENMP_AMDGCN__
38#define __RETURN_TYPE int
39#else
2940#if defined(__cplusplus)
3041#define __RETURN_TYPE bool
3142#else
3243#define __RETURN_TYPE int
3344#endif
45#endif // __OPENMP_AMDGCN__
3446
3547#if defined (__cplusplus) && __cplusplus < 201103L
3648// emulate static_assert on type sizes
......@@ -249,6 +261,9 @@ float fmodf(float __x, float __y) { return __ocml_fmod_f32(__x, __y); }
249261__DEVICE__
250262float frexpf(float __x, int *__nptr) {
251263 int __tmp;
264#ifdef __OPENMP_AMDGCN__
265#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
266#endif
252267 float __r =
253268 __ocml_frexp_f32(__x, (__attribute__((address_space(5))) int *)&__tmp);
254269 *__nptr = __tmp;
......@@ -334,6 +349,9 @@ long int lroundf(float __x) { return __ocml_round_f32(__x); }
334349__DEVICE__
335350float modff(float __x, float *__iptr) {
336351 float __tmp;
352#ifdef __OPENMP_AMDGCN__
353#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
354#endif
337355 float __r =
338356 __ocml_modf_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
339357 *__iptr = __tmp;
......@@ -414,6 +432,9 @@ float remainderf(float __x, float __y) {
414432__DEVICE__
415433float remquof(float __x, float __y, int *__quo) {
416434 int __tmp;
435#ifdef __OPENMP_AMDGCN__
436#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
437#endif
417438 float __r = __ocml_remquo_f32(
418439 __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
419440 *__quo = __tmp;
......@@ -470,6 +491,9 @@ __RETURN_TYPE __signbitf(float __x) { return __ocml_signbit_f32(__x); }
470491__DEVICE__
471492void sincosf(float __x, float *__sinptr, float *__cosptr) {
472493 float __tmp;
494#ifdef __OPENMP_AMDGCN__
495#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
496#endif
473497 *__sinptr =
474498 __ocml_sincos_f32(__x, (__attribute__((address_space(5))) float *)&__tmp);
475499 *__cosptr = __tmp;
......@@ -478,6 +502,9 @@ void sincosf(float __x, float *__sinptr, float *__cosptr) {
478502__DEVICE__
479503void sincospif(float __x, float *__sinptr, float *__cosptr) {
480504 float __tmp;
505#ifdef __OPENMP_AMDGCN__
506#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
507#endif
481508 *__sinptr = __ocml_sincospi_f32(
482509 __x, (__attribute__((address_space(5))) float *)&__tmp);
483510 *__cosptr = __tmp;
......@@ -790,6 +817,9 @@ double fmod(double __x, double __y) { return __ocml_fmod_f64(__x, __y); }
790817__DEVICE__
791818double frexp(double __x, int *__nptr) {
792819 int __tmp;
820#ifdef __OPENMP_AMDGCN__
821#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
822#endif
793823 double __r =
794824 __ocml_frexp_f64(__x, (__attribute__((address_space(5))) int *)&__tmp);
795825 *__nptr = __tmp;
......@@ -874,6 +904,9 @@ long int lround(double __x) { return __ocml_round_f64(__x); }
874904__DEVICE__
875905double modf(double __x, double *__iptr) {
876906 double __tmp;
907#ifdef __OPENMP_AMDGCN__
908#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
909#endif
877910 double __r =
878911 __ocml_modf_f64(__x, (__attribute__((address_space(5))) double *)&__tmp);
879912 *__iptr = __tmp;
......@@ -962,6 +995,9 @@ double remainder(double __x, double __y) {
962995__DEVICE__
963996double remquo(double __x, double __y, int *__quo) {
964997 int __tmp;
998#ifdef __OPENMP_AMDGCN__
999#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1000#endif
9651001 double __r = __ocml_remquo_f64(
9661002 __x, __y, (__attribute__((address_space(5))) int *)&__tmp);
9671003 *__quo = __tmp;
......@@ -1020,6 +1056,9 @@ double sin(double __x) { return __ocml_sin_f64(__x); }
10201056__DEVICE__
10211057void sincos(double __x, double *__sinptr, double *__cosptr) {
10221058 double __tmp;
1059#ifdef __OPENMP_AMDGCN__
1060#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1061#endif
10231062 *__sinptr = __ocml_sincos_f64(
10241063 __x, (__attribute__((address_space(5))) double *)&__tmp);
10251064 *__cosptr = __tmp;
......@@ -1028,6 +1067,9 @@ void sincos(double __x, double *__sinptr, double *__cosptr) {
10281067__DEVICE__
10291068void sincospi(double __x, double *__sinptr, double *__cosptr) {
10301069 double __tmp;
1070#ifdef __OPENMP_AMDGCN__
1071#pragma omp allocate(__tmp) allocator(omp_thread_mem_alloc)
1072#endif
10311073 *__sinptr = __ocml_sincospi_f64(
10321074 __x, (__attribute__((address_space(5))) double *)&__tmp);
10331075 *__cosptr = __tmp;
......@@ -1262,7 +1304,7 @@ float min(float __x, float __y) { return fminf(__x, __y); }
12621304__DEVICE__
12631305double min(double __x, double __y) { return fmin(__x, __y); }
12641306
1265#if !defined(__HIPCC_RTC__)
1307#if !defined(__HIPCC_RTC__) && !defined(__OPENMP_AMDGCN__)
12661308__host__ inline static int min(int __arg1, int __arg2) {
12671309 return std::min(__arg1, __arg2);
12681310}
......@@ -1270,7 +1312,7 @@ __host__ inline static int min(int __arg1, int __arg2) {
12701312__host__ inline static int max(int __arg1, int __arg2) {
12711313 return std::max(__arg1, __arg2);
12721314}
1273#endif // __HIPCC_RTC__
1315#endif // !defined(__HIPCC_RTC__) && !defined(__OPENMP_AMDGCN__)
12741316#endif
12751317
12761318#pragma pop_macro("__DEVICE__")
lib/include/intrin.h+3
......@@ -574,6 +574,9 @@ void _WriteStatusReg(int, __int64);
574574unsigned short __cdecl _byteswap_ushort(unsigned short val);
575575unsigned long __cdecl _byteswap_ulong (unsigned long val);
576576unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 val);
577
578__int64 __mulh(__int64 __a, __int64 __b);
579unsigned __int64 __umulh(unsigned __int64 __a, unsigned __int64 __b);
577580#endif
578581
579582/*----------------------------------------------------------------------------*\
lib/include/openmp_wrappers/__clang_openmp_device_functions.h+27-5
......@@ -14,13 +14,13 @@
1414#error "This file is for OpenMP compilation only."
1515#endif
1616
17#pragma omp begin declare variant match( \
18 device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
19
2017#ifdef __cplusplus
2118extern "C" {
2219#endif
2320
21#pragma omp begin declare variant match( \
22 device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
23
2424#define __CUDA__
2525#define __OPENMP_NVPTX__
2626
......@@ -33,11 +33,33 @@ extern "C" {
3333#undef __OPENMP_NVPTX__
3434#undef __CUDA__
3535
36#ifdef __cplusplus
37} // extern "C"
36#pragma omp end declare variant
37
38#ifdef __AMDGCN__
39#pragma omp begin declare variant match(device = {arch(amdgcn)})
40
41// Import types which will be used by __clang_hip_libdevice_declares.h
42#ifndef __cplusplus
43#include <stdbool.h>
44#include <stdint.h>
3845#endif
3946
47#define __OPENMP_AMDGCN__
48#pragma push_macro("__device__")
49#define __device__
50
51/// Include declarations for libdevice functions.
52#include <__clang_hip_libdevice_declares.h>
53
54#pragma pop_macro("__device__")
55#undef __OPENMP_AMDGCN__
56
4057#pragma omp end declare variant
58#endif
59
60#ifdef __cplusplus
61} // extern "C"
62#endif
4163
4264// Ensure we make `_ZdlPv`, aka. `operator delete(void*)` available without the
4365// need to `include <new>` in C++ mode.
lib/include/openmp_wrappers/cmath+54
......@@ -75,4 +75,58 @@ __DEVICE__ float tgamma(float __x) { return ::tgammaf(__x); }
7575
7676#pragma omp end declare variant
7777
78#ifdef __AMDGCN__
79#pragma omp begin declare variant match(device = {arch(amdgcn)})
80
81#pragma push_macro("__constant__")
82#define __constant__ __attribute__((constant))
83#define __OPENMP_AMDGCN__
84
85#include <__clang_hip_cmath.h>
86
87#pragma pop_macro("__constant__")
88#undef __OPENMP_AMDGCN__
89
90// Define overloads otherwise which are absent
91#define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
92
93__DEVICE__ float acos(float __x) { return ::acosf(__x); }
94__DEVICE__ float acosh(float __x) { return ::acoshf(__x); }
95__DEVICE__ float asin(float __x) { return ::asinf(__x); }
96__DEVICE__ float asinh(float __x) { return ::asinhf(__x); }
97__DEVICE__ float atan(float __x) { return ::atanf(__x); }
98__DEVICE__ float atan2(float __x, float __y) { return ::atan2f(__x, __y); }
99__DEVICE__ float atanh(float __x) { return ::atanhf(__x); }
100__DEVICE__ float cbrt(float __x) { return ::cbrtf(__x); }
101__DEVICE__ float cosh(float __x) { return ::coshf(__x); }
102__DEVICE__ float erf(float __x) { return ::erff(__x); }
103__DEVICE__ float erfc(float __x) { return ::erfcf(__x); }
104__DEVICE__ float exp2(float __x) { return ::exp2f(__x); }
105__DEVICE__ float expm1(float __x) { return ::expm1f(__x); }
106__DEVICE__ float fdim(float __x, float __y) { return ::fdimf(__x, __y); }
107__DEVICE__ float hypot(float __x, float __y) { return ::hypotf(__x, __y); }
108__DEVICE__ int ilogb(float __x) { return ::ilogbf(__x); }
109__DEVICE__ float ldexp(float __arg, int __exp) {
110 return ::ldexpf(__arg, __exp);
111}
112__DEVICE__ float lgamma(float __x) { return ::lgammaf(__x); }
113__DEVICE__ float log1p(float __x) { return ::log1pf(__x); }
114__DEVICE__ float logb(float __x) { return ::logbf(__x); }
115__DEVICE__ float nextafter(float __x, float __y) {
116 return ::nextafterf(__x, __y);
117}
118__DEVICE__ float remainder(float __x, float __y) {
119 return ::remainderf(__x, __y);
120}
121__DEVICE__ float scalbn(float __x, int __y) { return ::scalbnf(__x, __y); }
122__DEVICE__ float sinh(float __x) { return ::sinhf(__x); }
123__DEVICE__ float tan(float __x) { return ::tanf(__x); }
124__DEVICE__ float tanh(float __x) { return ::tanhf(__x); }
125__DEVICE__ float tgamma(float __x) { return ::tgammaf(__x); }
126
127#undef __DEVICE__
128
129#pragma omp end declare variant
130#endif // __AMDGCN__
131
78132#endif
lib/include/openmp_wrappers/math.h+10
......@@ -48,4 +48,14 @@
4848
4949#pragma omp end declare variant
5050
51#ifdef __AMDGCN__
52#pragma omp begin declare variant match(device = {arch(amdgcn)})
53
54#define __OPENMP_AMDGCN__
55#include <__clang_hip_math.h>
56#undef __OPENMP_AMDGCN__
57
58#pragma omp end declare variant
59#endif
60
5161#endif
lib/libcxx/include/cwctype+2
......@@ -59,6 +59,7 @@ wctrans_t wctrans(const char* property);
5959
6060_LIBCPP_BEGIN_NAMESPACE_STD
6161
62#if defined(_LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H)
6263using ::wint_t _LIBCPP_USING_IF_EXISTS;
6364using ::wctrans_t _LIBCPP_USING_IF_EXISTS;
6465using ::wctype_t _LIBCPP_USING_IF_EXISTS;
......@@ -80,6 +81,7 @@ using ::towlower _LIBCPP_USING_IF_EXISTS;
8081using ::towupper _LIBCPP_USING_IF_EXISTS;
8182using ::towctrans _LIBCPP_USING_IF_EXISTS;
8283using ::wctrans _LIBCPP_USING_IF_EXISTS;
84#endif // _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
8385
8486_LIBCPP_END_NAMESPACE_STD
8587
lib/libcxx/include/string+19
......@@ -522,6 +522,7 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
522522#include <algorithm>
523523#include <compare>
524524#include <cstdio> // EOF
525#include <cstdlib>
525526#include <cstring>
526527#include <cwchar>
527528#include <initializer_list>
......@@ -1714,6 +1715,24 @@ private:
17141715 return data() <= __p && __p <= data() + size();
17151716 }
17161717
1718 _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
1719 void __throw_length_error() const {
1720#ifndef _LIBCPP_NO_EXCEPTIONS
1721 __basic_string_common<true>::__throw_length_error();
1722#else
1723 _VSTD::abort();
1724#endif
1725 }
1726
1727 _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
1728 void __throw_out_of_range() const {
1729#ifndef _LIBCPP_NO_EXCEPTIONS
1730 __basic_string_common<true>::__throw_out_of_range();
1731#else
1732 _VSTD::abort();
1733#endif
1734 }
1735
17171736 friend basic_string operator+<>(const basic_string&, const basic_string&);
17181737 friend basic_string operator+<>(const value_type*, const basic_string&);
17191738 friend basic_string operator+<>(value_type, const basic_string&);
lib/libcxx/include/vector+20
......@@ -281,6 +281,7 @@ erase_if(vector<T, Allocator>& c, Predicate pred); // C++20
281281#include <algorithm>
282282#include <climits>
283283#include <compare>
284#include <cstdlib>
284285#include <cstring>
285286#include <initializer_list>
286287#include <iosfwd> // for forward declaration of vector
......@@ -390,6 +391,25 @@ protected:
390391 is_nothrow_move_assignable<allocator_type>::value)
391392 {__move_assign_alloc(__c, integral_constant<bool,
392393 __alloc_traits::propagate_on_container_move_assignment::value>());}
394
395 _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
396 void __throw_length_error() const {
397#ifndef _LIBCPP_NO_EXCEPTIONS
398 __vector_base_common<true>::__throw_length_error();
399#else
400 _VSTD::abort();
401#endif
402 }
403
404 _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI
405 void __throw_out_of_range() const {
406#ifndef _LIBCPP_NO_EXCEPTIONS
407 __vector_base_common<true>::__throw_out_of_range();
408#else
409 _VSTD::abort();
410#endif
411 }
412
393413private:
394414 _LIBCPP_INLINE_VISIBILITY
395415 void __copy_assign_alloc(const __vector_base& __c, true_type)
lib/libcxx/include/wctype.h+10
......@@ -50,8 +50,18 @@ wctrans_t wctrans(const char* property);
5050#pragma GCC system_header
5151#endif
5252
53// TODO:
54// In the future, we should unconditionally include_next <wctype.h> here and instead
55// have a mode under which the library does not need libc++'s <wctype.h> or <cwctype>
56// at all (i.e. a mode without wchar_t). As it stands, we need to do that to completely
57// bypass the using declarations in <cwctype> when we did not include <wctype.h>.
58// Otherwise, a using declaration like `using ::wint_t` in <cwctype> will refer to
59// nothing (with using_if_exists), and if we include another header that defines one
60// of these declarations (e.g. <wchar.h>), the second `using ::wint_t` with using_if_exists
61// will fail because it does not refer to the same declaration.
5362#if __has_include_next(<wctype.h>)
5463# include_next <wctype.h>
64# define _LIBCPP_INCLUDED_C_LIBRARY_WCTYPE_H
5565#endif
5666
5767#ifdef __cplusplus
lib/libcxxabi/src/cxa_personality.cpp+1-1
......@@ -702,10 +702,10 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
702702 return;
703703 }
704704 landingPad = (uintptr_t)lpStart + landingPad;
705 results.landingPad = landingPad;
706705#else // __USING_SJLJ_EXCEPTIONS__
707706 ++landingPad;
708707#endif // __USING_SJLJ_EXCEPTIONS__
708 results.landingPad = landingPad;
709709 if (actionEntry == 0)
710710 {
711711 // Found a cleanup