[llvm] r348417 - [InstCombine] add/move tests for extractelement; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 5 13:56:13 PST 2018
Author: spatel
Date: Wed Dec 5 13:56:13 2018
New Revision: 348417
URL: http://llvm.org/viewvc/llvm-project?rev=348417&view=rev
Log:
[InstCombine] add/move tests for extractelement; NFC
Removed:
llvm/trunk/test/Transforms/InstCombine/vec_narrow.ll
Modified:
llvm/trunk/test/Transforms/InstCombine/scalarization.ll
Modified: llvm/trunk/test/Transforms/InstCombine/scalarization.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/scalarization.ll?rev=348417&r1=348416&r2=348417&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/scalarization.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/scalarization.ll Wed Dec 5 13:56:13 2018
@@ -47,8 +47,8 @@ for.end:
define float @extract_element_constant_index(<4 x float> %x) {
; CHECK-LABEL: @extract_element_constant_index(
-; CHECK-NEXT: [[R_LHS:%.*]] = extractelement <4 x float> [[X:%.*]], i32 2
-; CHECK-NEXT: [[R:%.*]] = fadd float [[R_LHS]], 0x4002A3D700000000
+; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x float> [[X:%.*]], i32 2
+; CHECK-NEXT: [[R:%.*]] = fadd float [[TMP1]], 0x4002A3D700000000
; CHECK-NEXT: ret float [[R]]
;
%add = fadd <4 x float> %x, <float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000, float 0x4002A3D700000000>
@@ -58,8 +58,8 @@ define float @extract_element_constant_i
define float @extract_element_variable_index(<4 x float> %x, i32 %y) {
; CHECK-LABEL: @extract_element_variable_index(
-; CHECK-NEXT: [[R_LHS:%.*]] = extractelement <4 x float> [[X:%.*]], i32 [[Y:%.*]]
-; CHECK-NEXT: [[R:%.*]] = fadd float [[R_LHS]], 1.000000e+00
+; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x float> [[X:%.*]], i32 [[Y:%.*]]
+; CHECK-NEXT: [[R:%.*]] = fadd float [[TMP1]], 1.000000e+00
; CHECK-NEXT: ret float [[R]]
;
%add = fadd <4 x float> %x, <float 1.0, float 1.0, float 1.0, float 1.0>
@@ -67,6 +67,36 @@ define float @extract_element_variable_i
ret float %r
}
+define float @extelt_binop_insertelt(<4 x float> %A, <4 x float> %B, float %f) {
+; CHECK-LABEL: @extelt_binop_insertelt(
+; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x float> [[B:%.*]], i32 0
+; CHECK-NEXT: [[E:%.*]] = fmul nnan float [[TMP1]], [[F:%.*]]
+; CHECK-NEXT: ret float [[E]]
+;
+ %C = insertelement <4 x float> %A, float %f, i32 0
+ %D = fmul nnan <4 x float> %C, %B
+ %E = extractelement <4 x float> %D, i32 0
+ ret float %E
+}
+
+; We recurse to find a scalarizable operand.
+; FIXME: We should propagate the IR flags including wrapping flags.
+
+define i32 @extelt_binop_binop_insertelt(<4 x i32> %A, <4 x i32> %B, i32 %f) {
+; CHECK-LABEL: @extelt_binop_binop_insertelt(
+; CHECK-NEXT: [[TMP1:%.*]] = extractelement <4 x i32> [[B:%.*]], i32 0
+; CHECK-NEXT: [[TMP2:%.*]] = add i32 [[TMP1]], [[F:%.*]]
+; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i32> [[B]], i32 0
+; CHECK-NEXT: [[E:%.*]] = mul i32 [[TMP2]], [[TMP3]]
+; CHECK-NEXT: ret i32 [[E]]
+;
+ %v = insertelement <4 x i32> %A, i32 %f, i32 0
+ %C = add <4 x i32> %v, %B
+ %D = mul nsw <4 x i32> %C, %B
+ %E = extractelement <4 x i32> %D, i32 0
+ ret i32 %E
+}
+
define float @extract_element_splat_constant_vector_variable_index(i32 %y) {
; CHECK-LABEL: @extract_element_splat_constant_vector_variable_index(
; CHECK-NEXT: ret float 2.000000e+00
Removed: llvm/trunk/test/Transforms/InstCombine/vec_narrow.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vec_narrow.ll?rev=348416&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vec_narrow.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vec_narrow.ll (removed)
@@ -1,10 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep "fadd float"
-
-
-define float @test(<4 x float> %A, <4 x float> %B, float %f) {
- %C = insertelement <4 x float> %A, float %f, i32 0 ; <%V> [#uses=1]
- %D = fadd <4 x float> %C, %B ; <%V> [#uses=1]
- %E = extractelement <4 x float> %D, i32 0 ; <float> [#uses=1]
- ret float %E
-}
-
More information about the llvm-commits
mailing list