Commit Graph

16323 Commits

Author SHA1 Message Date
Matt Arsenault 06c192d454 OpaquePtr: Bulk update tests to use typed byval
Upgrade of the IR text tests should be the only thing blocking making
typed byval mandatory. Partially done through regex and partially
manual.
2020-11-20 14:00:46 -05:00
Simon Pilgrim 0341029bb4 [X86][AVX] LowerADDSAT_SUBSAT - avoid X86ISD::BLENDV in UADDSAT/USUBSAT v8i32/v4i64 lowering
Use the OR(CMP,ADD) / AND(CMP,SUB) patterns like we do on SSE targets.

Enable custom lowering for v8i32/v4i64 and generalize the 128-bit lowering code for any vector size - this also lets us use the slightly cheaper codegen for icmp_ugt instead of umin/umax.
2020-11-20 18:16:44 +00:00
Simon Pilgrim 09a081f221 [X86][SSE] LowerADDSAT_SUBSAT - avoid X86ISD::BLENDV in UADDSAT/USUBSAT custom lowering
Use the OR(CMP,ADD) / AND(CMP,SUB) patterns like we do on pre-SSE4 targets.

We're still using X86ISD::BLENDV on some AVX targets as we don't do custom lowering for >= 256-bit vectors.

Really this (and combineVSelectWithAllOnesOrZeros) needs moving to DAGCombiner, but pre-SSE42 we see the vXi64 comparison type as a 2 x 32-bits result so we can't just rely on ComputeNumSignBits to give us the 'all bits' result we need.
2020-11-20 16:53:01 +00:00
Simon Pilgrim e3f0177deb [X86] Add SSE42 sat-add test coverage
Check SSE42 targets which have PCMPGTQ
2020-11-20 16:00:24 +00:00
QingShan Zhang 1b5921f4d8 [NFC][Test] Update test for IEEE Long Double 2020-11-20 09:57:45 +00:00
Leonard Chan a97f62837f [llvm][IR] Add dso_local_equivalent Constant
The `dso_local_equivalent` constant is a wrapper for functions that represents a
value which is functionally equivalent to the global passed to this. That is, if
this accepts a function, calling this constant should have the same effects as
calling the function directly. This could be a direct reference to the function,
the `@plt` modifier on X86/AArch64, a thunk, or anything that's equivalent to the
resolved function as a call target.

When lowered, the returned address must have a constant offset at link time from
some other symbol defined within the same binary. The address of this value is
also insignificant. The name is leveraged from `dso_local` where use of a function
or variable is resolved to a symbol in the same linkage unit.

In this patch:
- Addition of `dso_local_equivalent` and handling it
- Update Constant::needsRelocation() to strip constant inbound GEPs and take
  advantage of `dso_local_equivalent` for relative references

This is useful for the [Relative VTables C++ ABI](https://reviews.llvm.org/D72959)
which makes vtables readonly. This works by replacing the dynamic relocations for
function pointers in them with static relocations that represent the offset between
the vtable and virtual functions. If a function is externally defined,
`dso_local_equivalent` can be used as a generic wrapper for the function to still
allow for this static offset calculation to be done.

See [RFC](http://lists.llvm.org/pipermail/llvm-dev/2020-August/144469.html) for more details.

Differential Revision: https://reviews.llvm.org/D77248
2020-11-19 10:26:17 -08:00
Simon Pilgrim 14ae02fb33 [X86][AVX] Only share broadcasts of different widths from the same SDValue of the same SDNode (PR48215)
D57663 allowed us to reuse broadcasts of the same scalar value by extracting low subvectors from the widest type.

Unfortunately we weren't ensuring the broadcasts were from the same SDValue, just the same SDNode - which failed on multiple-value nodes like ISD::SDIVREM

FYI: I intend to request this be merged into the 11.x release branch.

Differential Revision: https://reviews.llvm.org/D91709
2020-11-19 12:15:18 +00:00
Kai Luo 5f0ae23e71 [X86][AArch64][RISCV] Pre-commit negated abs test case. NFC. 2020-11-19 02:31:45 +00:00
Simon Pilgrim 8270f8c252 [X86] Add broadcast merge test case for PR48215 2020-11-18 14:20:02 +00:00
Craig Topper f0b0bab34d [X86] Use GF2P8AFFINEQB to implement vector bitreverse.
We can use GF2P8AFFINEQB to reverse bits in a byte. Shuffles are needed to reverse the bytes in elements larger than i8. LegalizeVectorOps takes care of inserting the shuffle for the larger element size.

We already have Custom lowering for v16i8 with SSSE3, v32i8 with AVX, and v64i8 with AVX512BW.

I think we might be able to use this for scalars too by moving into a vector and back. But I'll save that for a follow up as its a little more involved.

Reviewed By: RKSimon, pengfei

Differential Revision: https://reviews.llvm.org/D91515
2020-11-17 23:49:06 -08:00
Nick Desaulniers f4c6080ab8 Revert "[IR] add fn attr for no_stack_protector; prevent inlining on mismatch"
This reverts commit b7926ce6d7.

Going with a simpler approach.
2020-11-17 17:27:14 -08:00
Simon Pilgrim 49e0de5f6f [X86] byval tests - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 18:32:44 +00:00
Simon Pilgrim d035bc3e6b [X86] emutls.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 18:32:43 +00:00
Simon Pilgrim ba82e7ee5c [X86] emutls-pie.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 18:32:43 +00:00
Simon Pilgrim 821439c506 [X86] emutls-pic.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 18:32:42 +00:00
Simon Pilgrim 811026b987 [X86] segmented-stacks tests - replace X32 check prefix with X86 for non-gnux32 tests. NFC.
Only use X32 for the gnux32 triples in the tests
2020-11-17 17:59:22 +00:00
Simon Pilgrim c331b7cc38 [X86] select-of-fp-constants.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 17:59:22 +00:00
Simon Pilgrim 3b4f9c16bf [X86] rot16.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 17:37:09 +00:00
Simon Pilgrim e741fa5c92 [X86] vec_fabs.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 17:37:09 +00:00
Simon Pilgrim 53fba9d9d3 [X86] nontemporal.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 16:16:51 +00:00
Simon Pilgrim d06a445ca4 [X86] subvector-broadcast.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 16:16:50 +00:00
Simon Pilgrim 0765d78a41 [X86] vector-sext.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 12:39:47 +00:00
Simon Pilgrim 74f6493587 [X86] insert-into-constant-vector.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 12:39:47 +00:00
Simon Pilgrim 3c933043e8 [X86] avx-intel-ocl.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 12:39:46 +00:00
Simon Pilgrim 7b099b1e1f [X86] 2011-10-19-widen_vselect.ll - replace X32 check prefix with X86. NFC.
We typically use X32 for gnux32 triples
2020-11-17 12:39:46 +00:00
Wang, Pengfei f4467c4d3b [CodeGen][X86] Remove some unused check-prefixes and regenerate tests. 2020-11-17 11:25:55 +08:00
Craig Topper 57c0c4a275 [X86] Fix crash with i64 bitreverse on 32-bit targets with XOP.
We unconditionally marked i64 as Custom, but did not install a
handler in ReplaceNodeResults when i64 isn't legal type. This
leads to ReplaceNodeResults asserting.

We have two options to fix this. Only mark i64 as Custom on
64-bit targets and let it expand to two i32 bitreverses which
each need a VPPERM. Or the other option is to add the Custom
handling to ReplaceNodeResults. This is what I went with.
2020-11-15 19:02:34 -08:00
Wang, Pengfei c22dc71b12 [CodeGen][X86] Remove unused trivial check-prefixes from all CodeGen/X86 directory.
I had manually removed unused prefixes from CodeGen/X86 directory for more than 100 tests.
I checked the change history for each of them at the beginning, and then I mainly focused on the format since I found all of the unused prefixes were result from either insensible copy or residuum after functional update.
I think it's OK to remove the remaining X86 tests by script now. I wrote a rough script which works for me in most tests. I put it in llvm/utils temporarily for review and hope it may help other components owners.
The tests in this patch are all generated by the tool and checked by update tool for the autogenerated tests. I skimmed them and checked about 30 tests and didn't find any unexpected changes.

Reviewed By: mtrofin, MaskRay

Differential Revision: https://reviews.llvm.org/D91496
2020-11-16 09:45:55 +08:00
Craig Topper a4124e455e [X86] When storing v1i1/v2i1/v4i1 to memory, make sure we store zeros in the rest of the byte
We can't store garbage in the unused bits. It possible that something like zextload from i1/i2/i4 is created to read the memory. Those zextloads would be legalized assuming the extra bits are 0.

I'm not sure that the code in lowerStore is executed for the v1i1/v2i1/v4i1 case. It looks like the DAG combine in combineStore may have converted them to v8i1 first. And I think we're missing some cases to avoid going to the stack in the first place. But I don't have time to investigate those things at the moment so I wanted to focus on the correctness issue.

Should fix PR48147.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D91294
2020-11-12 21:28:18 -08:00
Wang, Pengfei 990939c897 [CodeGen][X86] Remove unused check-prefixes from vec tests. NFCI. 2020-11-11 15:32:42 +08:00
Wang, Pengfei 2bd979ed99 [CodeGen][X86] Remove unused check-prefixes from vector tests. NFCI. 2020-11-11 15:14:04 +08:00
Wang, Pengfei d1ff394ee2 [CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI. 2020-11-11 14:50:28 +08:00
Wang, Pengfei 881b4d20f6 [CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI. 2020-11-11 14:19:14 +08:00
Wang, Pengfei 0e582781f3 [CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI. 2020-11-11 13:48:03 +08:00
Wang, Pengfei f7826b7729 [CodeGen][X86] Remove unused check-prefixes from vector tzcnt tests. NFCI. 2020-11-11 13:48:03 +08:00
Wang, Pengfei b7067480d2 [CodeGen][X86] Remove unused check-prefixes from vector shuffle tests. NFCI. 2020-11-11 12:00:52 +08:00
Wang, Pengfei 8b87fdb207 [CodeGen][X86] Remove unused check-prefixes from vector shift tests. NFCI. 2020-11-11 12:00:52 +08:00
Wang, Pengfei a28eaafc23 [CodeGen][X86] Remove unused check-prefixes from vector reduce tests. NFCI. 2020-11-11 12:00:52 +08:00
Wang, Pengfei 5f96fd06ac [CodeGen][X86] Remove unused check-prefixes from vector popcnt tests. NFCI. 2020-11-11 12:00:52 +08:00
Wang, Pengfei 659230ff80 [CodeGen][X86] Remove unused check-prefixes from mask tests. NFCI. 2020-11-11 11:09:41 +08:00
Wang, Pengfei 07ba0662da [CodeGen][X86] Remove unused check-prefixes from bitcast tests. NFCI. 2020-11-11 09:16:57 +08:00
Simon Pilgrim 05954c2b69 [X86] Remove unused check-prefixes from vector rotate tests 2020-11-10 15:45:38 +00:00
Simon Pilgrim 75adc8bb4b [X86] Remove unused check-prefixes from vector trunc tests 2020-11-10 15:45:38 +00:00
Simon Pilgrim 4f95f90b94 [X86] Remove unused check-prefixes from vector funnel shift tests 2020-11-10 15:45:37 +00:00
Wang, Pengfei a6428fcd32 [CodeGen][X86] Remove unused check-prefixes from more avx512 tests. NFCI. 2020-11-10 20:43:03 +08:00
Wang, Pengfei bd01a66675 [CodeGen][X86] Remove unused check-prefixes from some avx512 tests. NFCI. 2020-11-10 20:03:43 +08:00
Simon Pilgrim a45a903a21 [X86] Remove unused check-prefixes from some vector tests 2020-11-10 10:48:48 +00:00
Wang, Pengfei 97fbc785f9 [CodeGen][X86] Remove unused check-prefixes. NFCI. 2020-11-10 16:50:28 +08:00
Fangrui Song 8774414d6e [FastISel][test] %llc_dwarf -mtriple -> llc -mtriple
if config.target_triple contains 'windows-msvc', %llc_dwarf has a -mtriple:

    llc.exe: for the --mtriple option: may only occur zero or one times!
2020-11-09 12:10:44 -08:00
Fangrui Song 1867091f56 [FastISel][test] Add ELF triple after D90877
MachO has different symbol naming and thus on a MachO platform this test has a
different behavior without a triple.
2020-11-09 10:27:36 -08:00