48833 Commits

Author SHA1 Message Date
Nekotekina 60611c0f23 X86: detect pattern for variable SHL/SRL shifts (AVX2+)
Remove VSELECT instruction which zeroes their result on exceeding shift amount
2018-07-06 00:24:31 +03:00
Nekotekina 2fbca18b9b X86: add pattern for X86ISD::ADDUS
combineSelect: detect unsigned overflow check
2018-07-05 23:49:43 +03:00
Nekotekina 1cfac3c250 X86: add pattern for X86ISD::VSRAV
Detect clamping ashr shift amount to max legal value
2018-07-05 23:49:43 +03:00
Nekotekina 06b0febe10 X86: expand detectAVGPattern()
Allow all integer widths in the pattern, allow ashr
Handle signed and mixed cases, allowing to replace truncation
2018-07-05 23:49:43 +03:00
Nekotekina 4f4d685d55 X86: optimize VSELECT for v16i8 with shl + sign bit test 2018-07-05 23:49:43 +03:00
Nekotekina 1741bfd9ab X86: change v64i8 sar by 7
Use ADDUS (add with unsigned saturation)
addus(0, 0) = 0
addus(0x80, 0x80) = 0xff
2018-07-05 23:49:43 +03:00
Nekotekina 9ab400af3c X86: combine inversion of VPTERNLOG 2018-07-05 23:49:43 +03:00
Nekotekina 33db22b728 X86: LowerShift: new algorithm for vector-vector shifts
Emit pair of shifts of double size if possible
2018-07-05 23:49:43 +03:00
Nekotekina 93b5ee4faa X86: Fix/workaround Small Code Model for JIT
Force RIP-relative jump tables and global values
Force RIP-relative all zeros / all ones constants
These things were causing crashes due to use of absolute addressing
2018-07-05 23:49:43 +03:00
Nekotekina 6746b3dd2e Remove trailing space 2018-07-05 23:49:43 +03:00
Craig Topper c9994c8acf [X86] Remove the last of the 'x86.fma.' intrinsics and autoupgrade them to 'llvm.fma'. Add upgrade tests for all.
Still need to remove the AVX512 masked versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336383 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 18:43:58 +00:00
Craig Topper 6e0b82fc61 [X86] Add SHUF128 to target shuffle decoding.
Differential Revision: https://reviews.llvm.org/D48954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336376 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 17:10:17 +00:00
Matt Arsenault e5d3d15134 AMDGPU/GlobalISel: Implement custom kernel arg lowering
Avoid using allocateKernArg / AssignFn. We do not want any
of the type splitting properties of normal calling convention
lowering.

For now at least this exists alongside the IR argument lowering
pass. This is necessary to handle struct padding correctly while
some arguments are still skipped by the IR argument lowering
pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336373 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 17:01:20 +00:00
Simon Pilgrim a46b1e54f3 [CostModel][X86] Add UDIV/UREM by pow2 costs
Normally InstCombine would have simplified these to SRL/AND instructions but we may still see these during SLP vectorization etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336371 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 16:56:28 +00:00
Lei Huang 37aa5135e5 [Power9] Add lib calls for float128 operations with no equivalent PPC instructions
Map the following instructions to the proper float128 lib calls:
  pow[i], exp[2], log[2|10], sin, cos, fmin, fmax

Differential Revision: https://reviews.llvm.org/D48544

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336361 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 15:21:37 +00:00
Ryan Taylor e941c76442 [AMDGPU] Add VALU to V_INTERP Instructions
Wait states are not properly being inserted after buffer_store for v_interp instructions.

Add VALU to V_INTERP instructions so that the GCNHazardRecognizer can
check and insert the appropriate wait states when needed.

Differential Revision: https://reviews.llvm.org/D48772

Change-Id: Id540c9b074fc69b5c1de6b182276aa089c74aa64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336339 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 12:02:07 +00:00
Simon Pilgrim a7eead2e39 Try to fix -Wimplicit-fallthrough warning. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336331 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 09:48:01 +00:00
Aleksandar Beserminji f9df18f4ce [mips] Fix atomic operations at O0, v3
Similar to PR/25526, fast-regalloc introduces spills at the end of basic
blocks. When this occurs in between an ll and sc, the stores can cause the
atomic sequence to fail.

This patch fixes the issue by introducing more pseudos to represent atomic
operations and moving their lowering to after the expansion of postRA
pseudos.

This version addresses issues with the initial implementation and covers
all atomic operations.

This resolves PR/32020.

Thanks to James Cowgill for reporting the issue!

Patch By: Simon Dardis

Differential Revision: https://reviews.llvm.org/D31287


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336328 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 09:27:05 +00:00
Ivan A. Kosarev e816e74216 [NEON] Fix combining of vldx_dup intrinsics with updating of base addresses
Resolves:
Unsupported ARM Neon intrinsics in Target-specific DAG combine
function for VLDDUP
https://bugs.llvm.org/show_bug.cgi?id=38031

Related diff: D48439

Differential Revision: https://reviews.llvm.org/D48920


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336325 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 08:59:49 +00:00
Sander de Smalen 797624f826 Reverting r336322 for now, as it causes an assert failure
in TableGen, for which there is already a patch in Phabricator
(D48937) that needs to be committed first.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336324 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 08:52:03 +00:00
Sander de Smalen 45a7a31f48 [AArch64][SVE] Asm: Support for predicated FP rounding instructions.
This patch also adds instructions for predicated FP square-root and
reciprocal exponent.

The added instructions are:
- FRINTI  Round to integral value (current FPCR rounding mode)
- FRINTX  Round to integral value (current FPCR rounding mode, signalling inexact)
- FRINTA  Round to integral value (to nearest, with ties away from zero)
- FRINTN  Round to integral value (to nearest, with ties to even)
- FRINTZ  Round to integral value (toward zero)
- FRINTM  Round to integral value (toward minus Infinity)
- FRINTP  Round to integral value (toward plus Infinity)
- FSQRT   Floating-point square root
- FRECPX  Floating-point reciprocal exponent


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 08:38:30 +00:00
Sjoerd Meijer 802e5e3d9a [ARM] ParallelDSP: only support i16 loads for now
We were miscompiling i8 loads, so reject them as unsupported narrow operations
for now.

Differential Revision: https://reviews.llvm.org/D48944


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336319 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 08:21:40 +00:00
Sander de Smalen 0e87e9463a [AArch64][SVE] Asm: Support for signed/unsigned MIN/MAX/ABD
This patch implements the following varieties:

- Unpredicated signed max,   e.g. smax z0.h, z1.h, #-128
- Unpredicated signed min,   e.g. smin z0.h, z1.h, #-128

- Unpredicated unsigned max, e.g. umax z0.h, z1.h, #255
- Unpredicated unsigned min, e.g. umin z0.h, z1.h, #255

- Predicated signed max,     e.g. smax z0.h, p0/m, z0.h, z1.h
- Predicated signed min,     e.g. smin z0.h, p0/m, z0.h, z1.h
- Predicated signed abd,     e.g. sabd z0.h, p0/m, z0.h, z1.h

- Predicated unsigned max,   e.g. umax z0.h, p0/m, z0.h, z1.h
- Predicated unsigned min,   e.g. umin z0.h, p0/m, z0.h, z1.h
- Predicated unsigned abd,   e.g. uabd z0.h, p0/m, z0.h, z1.h



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336317 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 07:54:10 +00:00
Lei Huang bd76e146be [Power9] Optimize codgen for conversions of int to float128
Optimize code sequences for integer conversion to fp128 when the integer is a result of:
  * float->int
  * float->long
  * double->int
  * double->long

Differential Revision: https://reviews.llvm.org/D48429

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336316 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 07:46:01 +00:00
Craig Topper 5f1cfe90f3 [X86] Remove X86 specific scalar FMA intrinsics and upgrade to tart independent FMA and extractelement/insertelement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336315 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 06:52:55 +00:00
Lei Huang ddc48fa71f [Power9] Ensure float128 in non-homogenous aggregates are passed via VSX reg
Non-homogenous aggregates are passed in consecutive GPRs, in GPRs and in memory,
or in memory. This patch ensures that float128 members of non-homogenous
aggregates are passed via VSX registers.

This is done via custom lowering a bitcast of a build_pari(i64,i64) to float128
to a new PPCISD node, BUILD_FP128.

Differential Revision: https://reviews.llvm.org/D48308

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336310 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 06:21:37 +00:00
Lei Huang 1ae65deb24 [Power9]Legalize and emit code for quad-precision convert from single-precision
Legalize and emit code for quad-precision floating point operation conversion of
single-precision value to quad-precision.

Differential Revision: https://reviews.llvm.org/D47569

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336307 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 04:18:37 +00:00
Lei Huang b42f206bec [Power9] Implement float128 parameter passing and return values
This patch enable parameter passing and return by value for float128 types.
Passing aggregate/union which contain float128 members will be submitted in
subsequent patches.

Differential Revision: https://reviews.llvm.org/D47552

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336306 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 04:10:15 +00:00
Craig Topper 12fed3cda6 [X86] Remove some isel patterns for X86ISD::SELECTS that specifically looked for the v1i1 mask to have come from a scalar_to_vector from GR8.
We have patterns for SELECTS that top at v1i1 and we have a pattern for (v1i1 (scalar_to_vector GR8)). The patterns being removed here do the same thing as the two other patterns combined so there is no need for them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336305 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 03:01:29 +00:00
Craig Topper 585ca3a7f5 [X86] Add support for combining FMSUB/FNMADD/FNMSUB ISD nodes with an fneg input.
Previously we could only negate the FMADD opcodes. This used to be mostly ok when we lowered FMA intrinsics during lowering. But with the move to llvm.fma from target specific intrinsics, we can combine (fneg (fma)) to (fmsub) earlier. So if we start with (fneg (fma (fneg))) we would get stuck at (fmsub (fneg)).

This patch fixes that so we can also combine things like (fmsub (fneg)).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336304 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 02:52:56 +00:00
Craig Topper 3d92cb5cdd [X86] Remove some of the packed FMA3 intrinsics since we no longer use them in clang.
There's a regression in here due to inability to combine fneg inputs of X86ISD::FMSUB/FNMSUB/FNMADD nodes.

More removals to come, but I wanted to stop and fix the regression that showed up in this first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336303 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-05 02:52:54 +00:00
Lei Huang 4fcda06d85 [Power9]Legalize and emit code for round & convert quad-precision values
Legalize and emit code for round & convert float128 to double precision and
single precision.

Differential Revision: https://reviews.llvm.org/D46997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336299 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 21:59:16 +00:00
Vladimir Stefanovic d04690c89b [mips] Warn when crc, ginv, virt flags are used with too old revision
CRC and GINV ASE require revision 6, Virtualization requires revision 5.
Print a warning when revision is older than required.

Differential Revision: https://reviews.llvm.org/D48843



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336296 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 19:26:31 +00:00
Stefan Pintilie 1631efd1b8 [PowerPC] Replace the Post RA List Scheduler with the Machine Scheduler
We want to run the Machine Scheduler instead of the List Scheduler after RA.
  Checked with a performance run on a Power 9 machine with SPEC 2006 and while
  some benchmarks improved and others degraded the geomean was slightly improved
  with the Machine Scheduler.

  Differential Revision: https://reviews.llvm.org/D45265

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336295 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 18:54:25 +00:00
Volodymyr Turanskyy 851b403537 [ARM] [Assembler] Support negative immediates: cover few missing cases
Support for negative immediates was implemented in
https://reviews.llvm.org/rL298380, however few instruction options were missing.

This change adds negative immediates support and respective tests
for the following:

ADD
ADDS
ADDS.W
AND.W
ANDS
BIC.W
BICS
BICS.W
SUB
SUBS
SUBS.W

Differential Revision: https://reviews.llvm.org/D48649

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336286 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 16:11:15 +00:00
Yvan Roux 195a60c5f5 [MachineOutliner] Fix typo in getOutliningCandidateInfo function name
getOutlininingCandidateInfo -> getOutliningCandidateInfo

Differential Revision: https://reviews.llvm.org/D48867

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336285 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 15:37:08 +00:00
Sander de Smalen 5a15e424fb [AArch64][SVE] Asm: Support for reversed subtract (SUBR) instruction.
This patch adds both a vector and an immediate form, e.g.                  
                                                                           
- Vector form:                                                             
                                                                           
    subr z0.h, p0/m, z0.h, z1.h                                            
                                                                           
  subtract active elements of z0 from z1, and store the result in z0.      
                                                                           
- Immediate form:                                                          
                                                                           
    subr z0.h, z0.h, #255                                                  
                                                                           
  subtract elements of z0, and store the result in z0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336274 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 14:05:33 +00:00
Sander de Smalen c8d61cbaa4 [AArch64][SVE] Asm: Support for instructions to set/read FFR.
Includes instructions to read the First-Faulting Register (FFR):
- RDFFR (unpredicated)
    rdffr   p0.b
- RDFFR (predicated)
    rdffr   p0.b, p0/z
- RDFFRS (predicated, sets condition flags)
    rdffr   p0.b, p0/z

Includes instructions to set/write the FFR:
- SETFFR (no arguments, sets the FFR to all true)
    setffr
- WRFFR  (unpredicated)
    wrffr   p0.b



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336267 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 12:58:46 +00:00
Sander de Smalen 3b4c054b7b [AArch64][SVE] Asm: Support for FP conversion instructions.
The variants added are:

- fcvt   (FP convert precision)
- scvtf  (signed int -> FP) 
- ucvtf  (unsigned int -> FP) 
- fcvtzs (FP -> signed int (round to zero))
- fcvtzu (FP -> unsigned int (round to zero))

For example:
  fcvt   z0.h, p0/m, z0.s  (single- to half-precision FP) 
  scvtf  z0.h, p0/m, z0.s  (32-bit int to half-precision FP) 
  ucvtf  z0.h, p0/m, z0.s  (32-bit unsigned int to half-precision FP) 
  fcvtzs z0.s, p0/m, z0.h  (half-precision FP to 32-bit int)
  fcvtzu z0.s, p0/m, z0.h  (half-precision FP to 32-bit unsigned int)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336265 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 12:13:17 +00:00
Simon Pilgrim c8da7b28b9 [X86][SSE] Blend any v8i16/v4i32 shift with 2 shift unique values (REAPPLIED)
We were only doing this for basic blends, despite shuffle lowering now being good enough to handle more complex blends. This means that the two v8i16 splat shifts are performed in parallel instead of serially as the general shift case.

Reapplied with a fixed (extra null tests) version of rL336113 after reversion in rL336189 - extra test case added at rL336247.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336250 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 09:12:48 +00:00
Sander de Smalen 71ab3ef1d7 [AArch64][SVE] Asm: Support for SVE condition code aliases
SVE overloads the AArch64 PSTATE condition flags and introduces
a set of condition code aliases for the assembler. The 
details are described in section 2.2 of the architecture
reference manual supplement for SVE.

In short:

  SVE alias =>  AArch64 name
  --------------------------
  NONE      => EQ
  ANY       => NE
  NLAST     => HS
  LAST      => LO
  FIRST     => MI
  NFRST     => PL
  PMORE     => HI
  PLAST     => LS
  TCONT     => GE
  TSTOP     => LT

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D48869



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336245 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-04 08:50:49 +00:00
Jacques Pienaar bdd6a09688 [lanai] Handle atomic load of i8 like regular load.
Loads and stores less than 64-bits are already atomic, this adds support for a special case thereof. This needs to be expanded.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336236 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 22:57:51 +00:00
Fangrui Song 7ead4232da [X86][AsmParser] Fix inconsistent declaration parameter name in r336218
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336232 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 21:40:03 +00:00
Benjamin Kramer 4bbb8b7d1f [NVPTX] Expand v2f16 INSERT_VECTOR_ELT
Vectorization can create them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336227 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 20:40:04 +00:00
Craig Topper dee3b3b081 [X86] Remove repeated 'the' from multiple comments that have been copy and pasted. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336226 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 20:39:55 +00:00
Fangrui Song e1d12229c2 [ARM] Fix inconsistent declaration parameter name in r336195
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336223 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 19:12:27 +00:00
Fangrui Song 92dfb6e324 [AArch64] Make function parameter names in declarations match those of definitions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336222 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 19:07:53 +00:00
Craig Topper f4212f0917 [X86][AsmParser] Rework the in/out (%dx) hack one more time.
This patch adds a new token type specifically for (%dx). We will now always create this token when we parse (%dx). After all operands have been parsed, if the mnemonic is in/out we'll morph this token to a regular register token. Otherwise we keep it as the special DX token which won't match any instructions.

This removes the need for passing Mnemonic through the parsing functions. It also seems closer to gas where when its used on the wrong instruction it just gets diagnosed as an invalid operand rather than a bad memory address.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336218 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 18:07:30 +00:00
Craig Topper 773b6e5431 [X86][AsmParser] Don't consider %eip as a valid register outside of 32-bit mode.
This might make the error message added in r335668 unneeded, but I'm not sure yet.

The check for RIP is technically unnecessary since RIP is in GR64, but that fact is kind of surprising so be explicit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336217 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 17:40:51 +00:00
Sander de Smalen a06d966cff [AArch64][SVE] Asm: Support for FP Complex ADD/MLA.
The variants added in this patch are:

- Predicated Complex floating point ADD with rotate, e.g.

   fcadd   z0.h, p0/m, z0.h, z1.h, #90

- Predicated Complex floating point MLA with rotate, e.g.

   fcmla   z0.h, p0/m, z1.h, z2.h, #180

- Unpredicated Complex floating point MLA with rotate (indexed operand), e.g.

   fcmla   z0.h, p0/m, z1.h, z2.h[0], #180

Reviewers: rengolin, fhahn, SjoerdMeijer, samparker, javed.absar

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D48824


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336210 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-03 16:01:27 +00:00