diff options
Diffstat (limited to 'test/Transforms/InstCombine/signext.ll')
-rw-r--r-- | test/Transforms/InstCombine/signext.ll | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/signext.ll b/test/Transforms/InstCombine/signext.ll index bccadeb396f2..ff92ec0a8e3c 100644 --- a/test/Transforms/InstCombine/signext.ll +++ b/test/Transforms/InstCombine/signext.ll @@ -61,6 +61,10 @@ define i32 @test5(i32 %x) { ret i32 %tmp.4 } +; If the shift amount equals the difference in width of the destination +; and source scalar types: +; ashr (shl (zext X), C), C --> sext X + define i32 @test6(i16 %P) { ; CHECK-LABEL: @test6( ; CHECK-NEXT: [[TMP_5:%.*]] = sext i16 %P to i32 @@ -72,6 +76,19 @@ define i32 @test6(i16 %P) { ret i32 %tmp.5 } +; Vectors should get the same fold as above. + +define <2 x i32> @test6_splat_vec(<2 x i12> %P) { +; CHECK-LABEL: @test6_splat_vec( +; CHECK-NEXT: [[ASHR:%.*]] = sext <2 x i12> %P to <2 x i32> +; CHECK-NEXT: ret <2 x i32> [[ASHR]] +; + %z = zext <2 x i12> %P to <2 x i32> + %shl = shl <2 x i32> %z, <i32 20, i32 20> + %ashr = ashr <2 x i32> %shl, <i32 20, i32 20> + ret <2 x i32> %ashr +} + define i32 @test7(i32 %x) { ; CHECK-LABEL: @test7( ; CHECK-NEXT: [[SUB:%.*]] = ashr i32 %x, 5 |