[llvm] r343041 - [InstCombine] add fneg variation of shuffle-binop fold; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 25 15:48:58 PDT 2018
Author: spatel
Date: Tue Sep 25 15:48:58 2018
New Revision: 343041
URL: http://llvm.org/viewvc/llvm-project?rev=343041&view=rev
Log:
[InstCombine] add fneg variation of shuffle-binop fold; NFC
If the fsub in this pattern was replaced by an actual fneg
instruction, we would need to add a fold to recognize that
because fneg would not be a binop.
Modified:
llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
Modified: llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll?rev=343041&r1=343040&r2=343041&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/vec_shuffle.ll Tue Sep 25 15:48:58 2018
@@ -913,6 +913,17 @@ define <2 x float> @fsub_splat_constant1
ret <2 x float> %r
}
+define <2 x float> @fneg(<2 x float> %x) {
+; CHECK-LABEL: @fneg(
+; CHECK-NEXT: [[TMP1:%.*]] = fsub <2 x float> <float -0.000000e+00, float undef>, [[X:%.*]]
+; CHECK-NEXT: [[R:%.*]] = shufflevector <2 x float> [[TMP1]], <2 x float> undef, <2 x i32> zeroinitializer
+; CHECK-NEXT: ret <2 x float> [[R]]
+;
+ %splat = shufflevector <2 x float> %x, <2 x float> undef, <2 x i32> zeroinitializer
+ %r = fsub <2 x float> <float -0.0, float -0.0>, %splat
+ ret <2 x float> %r
+}
+
define <2 x float> @fmul_splat_constant(<2 x float> %x) {
; CHECK-LABEL: @fmul_splat_constant(
; CHECK-NEXT: [[TMP1:%.*]] = fmul <2 x float> [[X:%.*]], <float 4.200000e+01, float undef>
More information about the llvm-commits
mailing list