@@ -1205,6 +1205,29 @@ define i1 @test_sign_pos(float %x) {
1205
1205
ret i1 %sign
1206
1206
}
1207
1207
1208
+ define i1 @test_sign_pos_half (half %x ) {
1209
+ ; CHECK-LABEL: @test_sign_pos_half(
1210
+ ; CHECK-NEXT: ret i1 true
1211
+ ;
1212
+ %fabs = call half @llvm.fabs.f16 (half %x )
1213
+ %y = bitcast half %fabs to i16
1214
+ %sign = icmp sgt i16 %y , -1
1215
+ ret i1 %sign
1216
+ }
1217
+
1218
+ define i1 @test_sign_pos_half_non_elementwise (<2 x half > %x ) {
1219
+ ; CHECK-LABEL: @test_sign_pos_half_non_elementwise(
1220
+ ; CHECK-NEXT: [[FABS:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
1221
+ ; CHECK-NEXT: [[Y:%.*]] = bitcast <2 x half> [[FABS]] to i32
1222
+ ; CHECK-NEXT: [[SIGN:%.*]] = icmp sgt i32 [[Y]], -1
1223
+ ; CHECK-NEXT: ret i1 [[SIGN]]
1224
+ ;
1225
+ %fabs = call <2 x half > @llvm.fabs.v2f16 (<2 x half > %x )
1226
+ %y = bitcast <2 x half > %fabs to i32
1227
+ %sign = icmp sgt i32 %y , -1
1228
+ ret i1 %sign
1229
+ }
1230
+
1208
1231
define i1 @test_sign_neg (float %x ) {
1209
1232
; CHECK-LABEL: @test_sign_neg(
1210
1233
; CHECK-NEXT: ret i1 true
@@ -1235,6 +1258,26 @@ define i32 @test_inf_only(float nofpclass(nan sub norm zero) %x) {
1235
1258
ret i32 %and
1236
1259
}
1237
1260
1261
+ define i16 @test_inf_only_bfloat (bfloat nofpclass(nan sub norm zero) %x ) {
1262
+ ; CHECK-LABEL: @test_inf_only_bfloat(
1263
+ ; CHECK-NEXT: ret i16 32512
1264
+ ;
1265
+ %y = bitcast bfloat %x to i16
1266
+ %and = and i16 %y , 32767
1267
+ ret i16 %and
1268
+ }
1269
+
1270
+ define i128 @test_inf_only_ppc_fp128 (ppc_fp128 nofpclass(nan sub norm zero) %x ) {
1271
+ ; CHECK-LABEL: @test_inf_only_ppc_fp128(
1272
+ ; CHECK-NEXT: [[Y:%.*]] = bitcast ppc_fp128 [[X:%.*]] to i128
1273
+ ; CHECK-NEXT: [[AND:%.*]] = and i128 [[Y]], 170141183460469231731687303715884105727
1274
+ ; CHECK-NEXT: ret i128 [[AND]]
1275
+ ;
1276
+ %y = bitcast ppc_fp128 %x to i128
1277
+ %and = and i128 %y , 170141183460469231731687303715884105727
1278
+ ret i128 %and
1279
+ }
1280
+
1238
1281
define i32 @test_zero_only (float nofpclass(nan sub norm inf) %x ) {
1239
1282
; CHECK-LABEL: @test_zero_only(
1240
1283
; CHECK-NEXT: ret i32 0
0 commit comments