You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow scalable vectors in ComputeNumSignBits and isKnownNonNull
This is a follow up to D136470 which extends the same scheme used there to ComputeNumSignBits and isKnownNonNull. As a reminder, for scalable vectors we track a single bit which is implicitly broadcast to all lanes. We do not know how many lanes there are statically, and thus have to be conservative along paths which require exact sizes.
Differential Revision: https://reviews.llvm.org/D137046
Copy file name to clipboardExpand all lines: llvm/test/Transforms/InstCombine/logical-select.ll
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -742,13 +742,11 @@ define <2 x i64> @bitcast_vec_cond(<16 x i1> %cond, <2 x i64> %c, <2 x i64> %d)
742
742
743
743
define <vscale x 2 x i64> @bitcast_vec_cond_scalable(<vscale x 16 x i1> %cond, <vscale x 2 x i64> %c, <vscale x 2 x i64> %d) {
744
744
; CHECK-LABEL: @bitcast_vec_cond_scalable(
745
-
; CHECK-NEXT: [[S:%.*]] = sext <vscale x 16 x i1> [[COND:%.*]] to <vscale x 16 x i8>
746
-
; CHECK-NEXT: [[T9:%.*]] = bitcast <vscale x 16 x i8> [[S]] to <vscale x 2 x i64>
747
-
; CHECK-NEXT: [[NOTT9:%.*]] = xor <vscale x 2 x i64> [[T9]], shufflevector (<vscale x 2 x i64> insertelement (<vscale x 2 x i64> poison, i64 -1, i32 0), <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer)
748
-
; CHECK-NEXT: [[T11:%.*]] = and <vscale x 2 x i64> [[NOTT9]], [[C:%.*]]
749
-
; CHECK-NEXT: [[T12:%.*]] = and <vscale x 2 x i64> [[T9]], [[D:%.*]]
750
-
; CHECK-NEXT: [[R:%.*]] = or <vscale x 2 x i64> [[T11]], [[T12]]
751
-
; CHECK-NEXT: ret <vscale x 2 x i64> [[R]]
745
+
; CHECK-NEXT: [[TMP1:%.*]] = bitcast <vscale x 2 x i64> [[D:%.*]] to <vscale x 16 x i8>
746
+
; CHECK-NEXT: [[TMP2:%.*]] = bitcast <vscale x 2 x i64> [[C:%.*]] to <vscale x 16 x i8>
747
+
; CHECK-NEXT: [[TMP3:%.*]] = select <vscale x 16 x i1> [[COND:%.*]], <vscale x 16 x i8> [[TMP1]], <vscale x 16 x i8> [[TMP2]]
748
+
; CHECK-NEXT: [[TMP4:%.*]] = bitcast <vscale x 16 x i8> [[TMP3]] to <vscale x 2 x i64>
749
+
; CHECK-NEXT: ret <vscale x 2 x i64> [[TMP4]]
752
750
;
753
751
%s = sext <vscale x 16 x i1> %condto <vscale x 16 x i8>
754
752
%t9 = bitcast <vscale x 16 x i8> %sto <vscale x 2 x i64>
Copy file name to clipboardExpand all lines: llvm/test/Transforms/InstCombine/select.ll
+2-5Lines changed: 2 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3409,24 +3409,21 @@ define <vscale x 2 x i32> @and_constant_select_svec(<vscale x 2 x i32> %x, <vsca
3409
3409
ret <vscale x 2 x i32> %b
3410
3410
}
3411
3411
3412
-
; TODO: shl should be nsw
3413
3412
define <vscale x 2 x i32> @scalable_sign_bits(<vscale x 2 x i8> %x) {
3414
3413
; CHECK-LABEL: @scalable_sign_bits(
3415
3414
; CHECK-NEXT: [[A:%.*]] = sext <vscale x 2 x i8> [[X:%.*]] to <vscale x 2 x i32>
3416
-
; CHECK-NEXT: [[B:%.*]] = shl <vscale x 2 x i32> [[A]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 16, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3415
+
; CHECK-NEXT: [[B:%.*]] = shl nsw <vscale x 2 x i32> [[A]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 16, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3417
3416
; CHECK-NEXT: ret <vscale x 2 x i32> [[B]]
3418
3417
;
3419
3418
%a = sext <vscale x 2 x i8> %xto <vscale x 2 x i32>
3420
3419
%b = shl <vscale x 2 x i32> %a, shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i3216, i320), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3421
3420
ret <vscale x 2 x i32> %b
3422
3421
}
3423
3422
3424
-
; TODO: can use ult
3425
3423
define <vscale x 2 x i1> @scalable_non_zero(<vscale x 2 x i32> %x) {
3426
3424
; CHECK-LABEL: @scalable_non_zero(
3427
3425
; CHECK-NEXT: [[A:%.*]] = or <vscale x 2 x i32> [[X:%.*]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 1, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3428
-
; CHECK-NEXT: [[B:%.*]] = add nsw <vscale x 2 x i32> [[A]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 -1, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3429
-
; CHECK-NEXT: [[CMP:%.*]] = icmp ult <vscale x 2 x i32> [[B]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 56, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3426
+
; CHECK-NEXT: [[CMP:%.*]] = icmp ule <vscale x 2 x i32> [[A]], shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i32 56, i32 0), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
3430
3427
; CHECK-NEXT: ret <vscale x 2 x i1> [[CMP]]
3431
3428
;
3432
3429
%a = or <vscale x 2 x i32> %x, shufflevector (<vscale x 2 x i32> insertelement (<vscale x 2 x i32> poison, i321, i320), <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer)
0 commit comments