@@ -1384,6 +1384,29 @@ define i1 @test_sign_pos(float %x) {
1384
1384
ret i1 %sign
1385
1385
}
1386
1386
1387
+ define i1 @test_sign_pos_half (half %x ) {
1388
+ ; CHECK-LABEL: @test_sign_pos_half(
1389
+ ; CHECK-NEXT: ret i1 true
1390
+ ;
1391
+ %fabs = call half @llvm.fabs.f16 (half %x )
1392
+ %y = bitcast half %fabs to i16
1393
+ %sign = icmp sgt i16 %y , -1
1394
+ ret i1 %sign
1395
+ }
1396
+
1397
+ define i1 @test_sign_pos_half_non_elementwise (<2 x half > %x ) {
1398
+ ; CHECK-LABEL: @test_sign_pos_half_non_elementwise(
1399
+ ; CHECK-NEXT: [[FABS:%.*]] = call <2 x half> @llvm.fabs.v2f16(<2 x half> [[X:%.*]])
1400
+ ; CHECK-NEXT: [[Y:%.*]] = bitcast <2 x half> [[FABS]] to i32
1401
+ ; CHECK-NEXT: [[SIGN:%.*]] = icmp sgt i32 [[Y]], -1
1402
+ ; CHECK-NEXT: ret i1 [[SIGN]]
1403
+ ;
1404
+ %fabs = call <2 x half > @llvm.fabs.v2f16 (<2 x half > %x )
1405
+ %y = bitcast <2 x half > %fabs to i32
1406
+ %sign = icmp sgt i32 %y , -1
1407
+ ret i1 %sign
1408
+ }
1409
+
1387
1410
define i1 @test_sign_neg (float %x ) {
1388
1411
; CHECK-LABEL: @test_sign_neg(
1389
1412
; CHECK-NEXT: ret i1 true
@@ -1414,6 +1437,26 @@ define i32 @test_inf_only(float nofpclass(nan sub norm zero) %x) {
1414
1437
ret i32 %and
1415
1438
}
1416
1439
1440
+ define i16 @test_inf_only_bfloat (bfloat nofpclass(nan sub norm zero) %x ) {
1441
+ ; CHECK-LABEL: @test_inf_only_bfloat(
1442
+ ; CHECK-NEXT: ret i16 32512
1443
+ ;
1444
+ %y = bitcast bfloat %x to i16
1445
+ %and = and i16 %y , 32767
1446
+ ret i16 %and
1447
+ }
1448
+
1449
+ define i128 @test_inf_only_ppc_fp128 (ppc_fp128 nofpclass(nan sub norm zero) %x ) {
1450
+ ; CHECK-LABEL: @test_inf_only_ppc_fp128(
1451
+ ; CHECK-NEXT: [[Y:%.*]] = bitcast ppc_fp128 [[X:%.*]] to i128
1452
+ ; CHECK-NEXT: [[AND:%.*]] = and i128 [[Y]], 170141183460469231731687303715884105727
1453
+ ; CHECK-NEXT: ret i128 [[AND]]
1454
+ ;
1455
+ %y = bitcast ppc_fp128 %x to i128
1456
+ %and = and i128 %y , 170141183460469231731687303715884105727
1457
+ ret i128 %and
1458
+ }
1459
+
1417
1460
define i32 @test_zero_only (float nofpclass(nan sub norm inf) %x ) {
1418
1461
; CHECK-LABEL: @test_zero_only(
1419
1462
; CHECK-NEXT: ret i32 0
0 commit comments