@@ -527,6 +527,23 @@ define i32 @test25_fast_shift(i32 %x) "target-features"="+alu-lsl-fast" {
527527 ret i32 %mul
528528}
529529
530+ define i32 @test29_fast_shift (i32 %x ) "target-features" ="+alu-lsl-fast" {
531+ ; CHECK-LABEL: test29_fast_shift:
532+ ; CHECK: // %bb.0:
533+ ; CHECK-NEXT: sub w8, w0, w0, lsl #3
534+ ; CHECK-NEXT: sub w0, w0, w8, lsl #2
535+ ; CHECK-NEXT: ret
536+ ;
537+ ; GISEL-LABEL: test29_fast_shift:
538+ ; GISEL: // %bb.0:
539+ ; GISEL-NEXT: mov w8, #29 // =0x1d
540+ ; GISEL-NEXT: mul w0, w0, w8
541+ ; GISEL-NEXT: ret
542+
543+ %mul = mul nsw i32 %x , 29 ; 29 = 1 - (1-8) * 4
544+ ret i32 %mul
545+ }
546+
530547define i32 @test45_fast_shift (i32 %x ) "target-features" ="+alu-lsl-fast" {
531548; CHECK-LABEL: test45_fast_shift:
532549; CHECK: // %bb.0:
@@ -615,6 +632,42 @@ define i32 @test97_fast_shift(i32 %x) "target-features"="+alu-lsl-fast" {
615632 ret i32 %mul
616633}
617634
635+ ; Negative test: The shift number 5 is out of bound
636+ define i32 @test125_fast_shift (i32 %x ) "target-features" ="+alu-lsl-fast" {
637+ ; CHECK-LABEL: test125_fast_shift:
638+ ; CHECK: // %bb.0:
639+ ; CHECK-NEXT: mov w8, #125 // =0x7d
640+ ; CHECK-NEXT: mul w0, w0, w8
641+ ; CHECK-NEXT: ret
642+ ;
643+ ; GISEL-LABEL: test125_fast_shift:
644+ ; GISEL: // %bb.0:
645+ ; GISEL-NEXT: mov w8, #125 // =0x7d
646+ ; GISEL-NEXT: mul w0, w0, w8
647+ ; GISEL-NEXT: ret
648+
649+ %mul = mul nsw i32 %x , 125 ; 63 = 1 - ((1-32) << 2)
650+ ret i32 %mul
651+ }
652+
653+ ; Negative test: The shift number 5 is out of bound
654+ define i32 @test225_fast_shift (i32 %x ) "target-features" ="+alu-lsl-fast" {
655+ ; CHECK-LABEL: test225_fast_shift:
656+ ; CHECK: // %bb.0:
657+ ; CHECK-NEXT: mov w8, #225 // =0xe1
658+ ; CHECK-NEXT: mul w0, w0, w8
659+ ; CHECK-NEXT: ret
660+ ;
661+ ; GISEL-LABEL: test225_fast_shift:
662+ ; GISEL: // %bb.0:
663+ ; GISEL-NEXT: mov w8, #225 // =0xe1
664+ ; GISEL-NEXT: mul w0, w0, w8
665+ ; GISEL-NEXT: ret
666+
667+ %mul = mul nsw i32 %x , 225 ; 225 = 1 - ((1-8) << 5)
668+ ret i32 %mul
669+ }
670+
618671; Negative test: The shift amount 5 larger than 4
619672define i32 @test297_fast_shift (i32 %x ) "target-features" ="+alu-lsl-fast" {
620673; CHECK-LABEL: test297_fast_shift:
@@ -910,9 +963,9 @@ define <4 x i32> @muladd_demand_commute(<4 x i32> %x, <4 x i32> %y) {
910963;
911964; GISEL-LABEL: muladd_demand_commute:
912965; GISEL: // %bb.0:
913- ; GISEL-NEXT: adrp x8, .LCPI52_0
966+ ; GISEL-NEXT: adrp x8, .LCPI55_0
914967; GISEL-NEXT: movi v3.4s, #1, msl #16
915- ; GISEL-NEXT: ldr q2, [x8, :lo12:.LCPI52_0 ]
968+ ; GISEL-NEXT: ldr q2, [x8, :lo12:.LCPI55_0 ]
916969; GISEL-NEXT: mla v1.4s, v0.4s, v2.4s
917970; GISEL-NEXT: and v0.16b, v1.16b, v3.16b
918971; GISEL-NEXT: ret
0 commit comments