Commit Graph

269 Commits

Author SHA1 Message Date
Craig Topper 84c1ade236 [X86] Modify the the rdtscp intrinsic to return values instead of taking a pointer argument
Similar to what was recently done for addcarry/subborrow and has been done for rdrand/rdseed for a while. It's better to use two results and an explicit store in IR when the store isn't part of the semantics of the instruction. This allows store->load forwarding to happen in the middle end. Or the store to be removed if its never loaded.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341698 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 19:14:15 +00:00
Craig Topper 3071b63207 [X86] Change the addcarry and subborrow intrinsics to return 2 results and remove the pointer argument.
We should represent the store directly in IR instead. This gives the middle end a chance to remove it if it can see a load from the same address.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341677 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-07 16:58:39 +00:00
Alexander Richardson 47ff67b78d Allow creating llvm::Function in non-zero address spaces
Most users won't have to worry about this as all of the
'getOrInsertFunction' functions on Module will default to the program
address space.

An overload has been added to Function::Create to abstract away the
details for most callers.

This is based on https://reviews.llvm.org/D37054 but without the changes to
make passing a Module to Function::Create() mandatory. I have also added
some more tests and fixed the LLParser to accept call instructions for
types in the program address space.

Reviewed By: bjope

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@340519 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-23 09:25:17 +00:00
Craig Topper 6914988dcf [X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select in IR instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339842 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-16 06:20:24 +00:00
Craig Topper 58d47fbc54 [X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.
Still need to remove masking from the 512-bit versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339841 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-16 06:20:22 +00:00
Simon Pilgrim 922ac36549 Fix MSVC "compiler limit: blocks nested too deeply" error. NFCI.
MSVC only accepts if-else chains up to 127 blocks long. I've had to merge a number of intrinsic cases together to get back below this limit, resulting in some duplication of string matches; this shouldn't cause any notable increase in runtime (and even then only for old IR, nothing that clang currently emits).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339666 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 10:04:14 +00:00
Tomasz Krupa 8ec69ac247 [X86] Lowering addus/subus intrinsics to native IR
Summary: This revision improves previous version (rL330322) which has been reverted due to crashes.

This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Reviewers: craig.topper, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mike.dvoretsky, DavidKreitzer, sroland, llvm-commits

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339650 91177308-0d34-0410-b5e6-96231b3b80d8
2018-08-14 08:00:56 +00:00
Fangrui Song af7b1832a0 Remove trailing space
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338293 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-30 19:41:25 +00:00
Craig Topper 18d8ba4a18 [X86] Remove and autoupgrade the scalar fma intrinsics with masking.
This converts them to what clang is now using for codegen. Unfortunately, there seem to be a few kinks to work out still. I'll try to address with follow up patches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336871 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-12 00:29:56 +00:00
Craig Topper a4e191b323 [X86] Remove FMA4 scalar intrinsics. Use llvm.fma intrinsic instead.
The intrinsics can be implemented with a f32/f64 llvm.fma intrinsic and an insert into a zero vector.

There are a couple regressions here due to SelectionDAG not being able to pull an fneg through an extract_vector_elt. I'm not super worried about this though as InstCombine should be able to do it before we get to SelectionDAG.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336416 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 07:14:41 +00:00
Craig Topper 89a40a3e5c [X86] Remove all of the avx512 masked packed fma intrinsics. Use llvm.fma or unmasked 512-bit intrinsics with rounding mode.
This upgrades all of the intrinsics to use fneg instructions to convert fma into fmsub/fnmsub/fnmadd/fmsubadd. And uses a select instruction for masking.

This matches how clang uses the intrinsics these days.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336409 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-06 03:42:09 +00: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 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
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
Craig Topper 8c0bb2f036 [X86] Remove masking from avx512 rotate intrinsics. Use select in IR instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336035 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-30 01:32:04 +00:00
Craig Topper a233e5b07a [X86] Remove masking from the avx512 packed sqrt intrinsics. Use select in IR instead.
While there improve the coverage of the intrinsic testing and add fast-isel tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335944 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-29 05:43:26 +00:00
Craig Topper 480d03dbeb [X86] Rename the autoupgraded of packed fp compare and fpclass intrinsics that don't take a mask as input to exclude '.mask.' from their name.
I think the intrinsics named 'avx512.mask.' should refer to the previous behavior of taking a mask argument in the intrinsic instead of using a 'select' or 'and' instruction in IR to accomplish the masking. This is more consistent with the goal that eventually we will have no intrinsics that have masking builtin. When we reach that goal, we should have no intrinsics named "avx512.mask".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335744 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-27 15:57:53 +00:00
Craig Topper d1d8627cf4 [X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction.
This recommits r335562 and 335563 as a single commit.

The frontend will surround the intrinsic with the appropriate marshalling to/from a scalar type to match the sigature of the builtin that software expects.

By exposing the vXi1 type directly in the llvm intrinsic we make it available to optimizers much earlier. This can enable the scalar marshalling code to be optimized away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335568 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 01:37:02 +00:00
Craig Topper 00cc8d0f09 Revert r335562 and 335563 "[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction."
These were supposed to have been squashed to a single commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335566 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 01:31:53 +00:00
Craig Topper 60f122c15f foo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335562 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-26 00:43:34 +00:00
Craig Topper cb5e58dbd9 [X86] Remove masking from 512-bit floating max/min intrinsics. Use select instruction instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335199 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-21 05:00:56 +00:00
Tomasz Krupa a36133dda7 [X86] Lowering sqrt intrinsics to native IR
Summary: Complementary patch to lowering sqrt intrinsics in Clang.

Reviewers: craig.topper, spatel, RKSimon, DavidKreitzer, uriel.k

Reviewed By: craig.topper

Subscribers: tkrupa, mike.dvoretsky, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334849 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-15 18:05:24 +00:00
Craig Topper c2287211da [X86] Remove masking from avx512vbmi2 concat and shift by immediate intrinsics. Use select in IR instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334576 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-13 07:19:21 +00:00
Craig Topper e5d2855ab4 [X86] Remove masking from dbpsadbw intrinsics, use select in IR instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334384 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 06:18:22 +00:00
Craig Topper 1eda80d0b0 [X86] Remove and autoupgrade the expandload and compressstore intrinsics.
We use the target independent intrinsics now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334381 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-11 01:25:22 +00:00
Craig Topper edd46a8e79 [X86] Remove masking from the 512-bit masked floating point add/sub/mul/div intrinsics. Use a select in IR instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334358 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-10 06:01:36 +00:00
Craig Topper 93d997435d [X86] Remove and autoupgrade masked avx512vnni intrinsics using the unmasked intrinsics and select instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333857 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-03 23:24:17 +00:00
Craig Topper a96fa2453b [X86] Remove masked vpermi2var/vpermt2var intrinsics and autoupgrade.
We have unmasked intrinsics now and wrap them with a select. This is a net reduction of 36 intrinsics from before the unmasked intrinsics were added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333388 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-29 05:22:05 +00:00
Craig Topper bfcd30f542 [X86] Remove masking from avx512ifma intrinsics. Use a select instead.
This allows us to avoid having mask and maskz variant. Reducing from 12 intrinsics to 6.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333346 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-26 18:55:19 +00:00
Craig Topper 6e21f26495 [X86] Remove 128/256-bit cvtdq2ps, cvtudq2ps, cvtqq2pd, cvtuqq2pd intrinsics.
These can all be implemented with sitofp/uitofp instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332916 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 23:15:00 +00:00
Craig Topper 343a521299 [X86] Remove masking from vpternlog intrinsics. Use a select in IR instead.
This removes 6 intrinsics since we no longer need separate mask and maskz intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332890 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-21 20:58:09 +00:00
Craig Topper aa228ef4a3 [X86] Remove mask arguments from permvar builtins/intrinsics. Use a select in IR instead.
Someday maybe we'll use selects for all intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332824 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-20 23:34:04 +00:00
Craig Topper 28daf68df7 [X86] Remove and autoupgrade avx512.vbroadcast.ss/avx512.vbroadcast.sd intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332271 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 18:21:22 +00:00
Craig Topper d4541505a5 [X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use uitofp+insertelement instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332206 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 00:06:49 +00:00
Craig Topper e6d357b0ce [X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332198 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-13 18:03:59 +00:00
Craig Topper 3d518c8296 [X86] Remove an autoupgrade legacy cvtss2sd intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332187 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-13 00:29:40 +00:00
Craig Topper fbe091db86 [X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what clang has used for a very long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332186 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-12 23:14:39 +00:00
Craig Topper 57cc768ae7 [X86] Remove some unused masked conversion intrinsics that can be replaced with an older intrinsic and a select.
This is what clang already uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332170 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-12 02:34:28 +00:00
Craig Topper c36d516fd6 [X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer used by clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332146 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-11 21:59:34 +00:00
Craig Topper e12166f8ad [X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332079 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-11 04:33:18 +00:00
Piotr Padlewski 9648b46325 Rename invariant.group.barrier to launder.invariant.group
Summary:
This is one of the initial commit of "RFC: Devirtualization v2" proposal:
https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing

Reviewers: rsmith, amharc, kuhar, sanjoy

Subscribers: arsenm, nhaehnle, javed.absar, hiraditya, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331448 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-03 11:03:01 +00:00
Chandler Carruth 8b02b588cb [x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsics
The LLVM commit introduces a crash in LLVM's instruction selection.

I filed http://llvm.org/PR37260 with the test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330997 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-26 21:46:01 +00:00
Reid Kleckner 72775a354c Fix -Wtautological-compare warning with npos on Windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330614 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-23 16:47:27 +00:00
Alexander Ivchenko b6965c7c4f Lowering x86 adds/addus/subs/subus intrinsics (llvm part)
This is the patch that lowers x86 intrinsics to native IR
in order to enable optimizations. The patch also includes folding
of previously missing saturation patterns so that IR emits the same
machine instructions as the intrinsics.

Patch by tkrupa

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330322 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-19 12:13:30 +00:00
Gerolf Hoflehner 753b745329 [IR] Upgrade comment token in objc retain release marker for asm call
Older compiler issued '#' instead of ';'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330173 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-17 04:02:24 +00:00
Craig Topper 754a558235 [X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR.
This completes the work started in r329604 and r329605 when we changed clang to no longer use the intrinsics.

We lost some InstCombine SimplifyDemandedBit optimizations through this change as we aren't able to fold 'and', bitcast, shuffle very well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329990 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-13 06:07:18 +00:00
Craig Topper 49b10db743 [X86] Remove 128/256-bit masked pmaddubsw and pmaddwd intrinsics. Replace 512-bit masked intrinsic with unmasked intrinsic and a select.
The 128/256-bit versions were no longer used by clang. It uses the legacy SSE/AVX2 version and a select. The 512-bit was changed to the same for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329774 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-11 04:55:04 +00:00
Craig Topper 6221e95d97 [X86] Merge some of the autoupgrade handling for masked intrinsics that just need to upgrade to an unmasked version plus a select. NFCI
These are were previously grouped in small groups of similarish intrinsics. But all the intrinsics have the same number of arguments and the same order. So we can move them all into a larger group for handling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329549 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-09 06:15:09 +00:00
Gerolf Hoflehner 7d9ae75740 [IR] Upgrade comment token in objc retain release marker
Older compiler issued '#' instead of ';'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329248 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-05 02:44:46 +00:00
Craig Topper b7da3a52b9 [X86] Add 512-bit unmasked pmulhrsw/pmulhw/pmulhuw intrinsics. Remove and auto upgrade 128/256/512 bit masked pmulhrsw/pmulhw/pmulhuw intrinsics.
The 128 and 256 bit versions were already not used by clang. This adds an equivalent unmasked 512 bit version. Then autoupgrades all sizes to use unmasked intrinsics plus select.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@325559 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-20 07:28:14 +00:00