diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/apint-select.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/apint-select.ll | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/llvm/test/Transforms/InstCombine/apint-select.ll b/llvm/test/Transforms/InstCombine/apint-select.ll index 049da268e5d..2aae232f1b0 100644 --- a/llvm/test/Transforms/InstCombine/apint-select.ll +++ b/llvm/test/Transforms/InstCombine/apint-select.ll @@ -41,11 +41,11 @@ define i999 @not_sext(i1 %C) { ret i999 %V } -; FIXME: Vector selects of vector splat constants match APInt too. +; Vector selects of vector splat constants match APInt too. define <2 x i41> @zext_vec(<2 x i1> %C) { ; CHECK-LABEL: @zext_vec( -; CHECK-NEXT: [[V:%.*]] = select <2 x i1> %C, <2 x i41> <i41 1, i41 1>, <2 x i41> zeroinitializer +; CHECK-NEXT: [[V:%.*]] = zext <2 x i1> %C to <2 x i41> ; CHECK-NEXT: ret <2 x i41> [[V]] ; %V = select <2 x i1> %C, <2 x i41> <i41 1, i41 1>, <2 x i41> <i41 0, i41 0> @@ -54,7 +54,7 @@ define <2 x i41> @zext_vec(<2 x i1> %C) { define <2 x i32> @sext_vec(<2 x i1> %C) { ; CHECK-LABEL: @sext_vec( -; CHECK-NEXT: [[V:%.*]] = select <2 x i1> %C, <2 x i32> <i32 -1, i32 -1>, <2 x i32> zeroinitializer +; CHECK-NEXT: [[V:%.*]] = sext <2 x i1> %C to <2 x i32> ; CHECK-NEXT: ret <2 x i32> [[V]] ; %V = select <2 x i1> %C, <2 x i32> <i32 -1, i32 -1>, <2 x i32> <i32 0, i32 0> @@ -63,7 +63,8 @@ define <2 x i32> @sext_vec(<2 x i1> %C) { define <2 x i999> @not_zext_vec(<2 x i1> %C) { ; CHECK-LABEL: @not_zext_vec( -; CHECK-NEXT: [[V:%.*]] = select <2 x i1> %C, <2 x i999> zeroinitializer, <2 x i999> <i999 1, i999 1> +; CHECK-NEXT: [[TMP1:%.*]] = zext <2 x i1> %C to <2 x i999> +; CHECK-NEXT: [[V:%.*]] = xor <2 x i999> [[TMP1]], <i999 1, i999 1> ; CHECK-NEXT: ret <2 x i999> [[V]] ; %V = select <2 x i1> %C, <2 x i999> <i999 0, i999 0>, <2 x i999> <i999 1, i999 1> @@ -72,13 +73,25 @@ define <2 x i999> @not_zext_vec(<2 x i1> %C) { define <2 x i64> @not_sext_vec(<2 x i1> %C) { ; CHECK-LABEL: @not_sext_vec( -; CHECK-NEXT: [[V:%.*]] = select <2 x i1> %C, <2 x i64> zeroinitializer, <2 x i64> <i64 -1, i64 -1> +; CHECK-NEXT: [[NOT_C:%.*]] = xor <2 x i1> %C, <i1 true, i1 true> +; CHECK-NEXT: [[V:%.*]] = sext <2 x i1> [[NOT_C]] to <2 x i64> ; CHECK-NEXT: ret <2 x i64> [[V]] ; %V = select <2 x i1> %C, <2 x i64> <i64 0, i64 0>, <2 x i64> <i64 -1, i64 -1> ret <2 x i64> %V } +; But don't touch this - we would need 3 instructions to extend and splat the scalar select condition. + +define <2 x i32> @scalar_select_of_vectors(i1 %c) { +; CHECK-LABEL: @scalar_select_of_vectors( +; CHECK-NEXT: [[V:%.*]] = select i1 %c, <2 x i32> <i32 1, i32 1>, <2 x i32> zeroinitializer +; CHECK-NEXT: ret <2 x i32> [[V]] +; + %V = select i1 %c, <2 x i32> <i32 1, i32 1>, <2 x i32> zeroinitializer + ret <2 x i32> %V +} + ;; (x <s 0) ? -1 : 0 -> ashr x, 31 define i41 @test3(i41 %X) { |

