@@ -5424,8 +5424,8 @@ for.cond.cleanup: ; preds = %vector.body
5424
5424
ret void
5425
5425
}
5426
5426
5427
- define void @sink_splat_select (ptr nocapture %a , i32 signext %x ) {
5428
- ; CHECK-LABEL: sink_splat_select :
5427
+ define void @sink_splat_select_op1 (ptr nocapture %a , i32 signext %x ) {
5428
+ ; CHECK-LABEL: sink_splat_select_op1 :
5429
5429
; CHECK: # %bb.0: # %entry
5430
5430
; CHECK-NEXT: lui a2, 1
5431
5431
; CHECK-NEXT: add a2, a0, a2
@@ -5460,3 +5460,41 @@ vector.body: ; preds = %vector.body, %entry
5460
5460
for.cond.cleanup: ; preds = %vector.body
5461
5461
ret void
5462
5462
}
5463
+
5464
+ define void @sink_splat_select_op2 (ptr nocapture %a , i32 signext %x ) {
5465
+ ; CHECK-LABEL: sink_splat_select_op2:
5466
+ ; CHECK: # %bb.0: # %entry
5467
+ ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
5468
+ ; CHECK-NEXT: vmv.v.x v8, a1
5469
+ ; CHECK-NEXT: lui a1, 1
5470
+ ; CHECK-NEXT: add a1, a0, a1
5471
+ ; CHECK-NEXT: li a2, 42
5472
+ ; CHECK-NEXT: .LBB118_1: # %vector.body
5473
+ ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
5474
+ ; CHECK-NEXT: vle32.v v9, (a0)
5475
+ ; CHECK-NEXT: vmseq.vx v0, v9, a2
5476
+ ; CHECK-NEXT: vmerge.vvm v9, v8, v9, v0
5477
+ ; CHECK-NEXT: vse32.v v9, (a0)
5478
+ ; CHECK-NEXT: addi a0, a0, 16
5479
+ ; CHECK-NEXT: bne a0, a1, .LBB118_1
5480
+ ; CHECK-NEXT: # %bb.2: # %for.cond.cleanup
5481
+ ; CHECK-NEXT: ret
5482
+ entry:
5483
+ %broadcast.splatinsert = insertelement <4 x i32 > poison, i32 %x , i32 0
5484
+ %broadcast.splat = shufflevector <4 x i32 > %broadcast.splatinsert , <4 x i32 > poison, <4 x i32 > zeroinitializer
5485
+ br label %vector.body
5486
+
5487
+ vector.body: ; preds = %vector.body, %entry
5488
+ %index = phi i64 [ 0 , %entry ], [ %index.next , %vector.body ]
5489
+ %0 = getelementptr inbounds i32 , ptr %a , i64 %index
5490
+ %load = load <4 x i32 >, ptr %0 , align 4
5491
+ %cond = icmp eq <4 x i32 > %load , splat (i32 42 )
5492
+ %1 = select <4 x i1 > %cond , <4 x i32 > %load , <4 x i32 > %broadcast.splat
5493
+ store <4 x i32 > %1 , ptr %0 , align 4
5494
+ %index.next = add nuw i64 %index , 4
5495
+ %2 = icmp eq i64 %index.next , 1024
5496
+ br i1 %2 , label %for.cond.cleanup , label %vector.body
5497
+
5498
+ for.cond.cleanup: ; preds = %vector.body
5499
+ ret void
5500
+ }
0 commit comments