[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 12 Feb 2020 16:07:16 +0000 (16:07 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 12 Feb 2020 16:07:27 +0000 (16:07 +0000)
commitff307c8120ecca89193576c38d68a0353ea49e8b
treef594997ac15d609f7f550de1e12efbf108244774
parent665dcdacc06b056c3279a1fccbcae4660d80f117
[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression

This has a really interesting side effect in that it improves some UMAX/UMIN reduction code which had redundant XOR(SHUFFLE(XOR(X,SIGNMASK)),SIGNMASK) patterns - the getNegatibleCost recognises it as FNEG(SHUFFLE(FNEG(X))).... We have a lot of FNEG patterns bitcasted to the integer domain for XOR signbit twiddling which is similar to what we do to allow UMAX/UMIN to be lowered using SMAX/SMIN.

Differential Revision: https://reviews.llvm.org/D74231
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/horizontal-reduce-umax.ll
llvm/test/CodeGen/X86/horizontal-reduce-umin.ll
llvm/test/CodeGen/X86/vector-reduce-umax.ll
llvm/test/CodeGen/X86/vector-reduce-umin.ll