aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-12-10[X86] Merge addcarryx/addcarry intrinsic into a single addcarry intrinsic.Craig Topper1-59/+40
Both intrinsics do the exact same thing so we really only need one. Earlier in the 8.0 cycle we changed the signature of this intrinsic without renaming it. But it looks difficult to get the autoupgrade code to allow me to merge the intrinsics and change the signature at the same time. So I've renamed the intrinsic slightly for the new merged intrinsic. I'm skipping autoupgrading from the previous new to 8.0 signature. I've also renamed the subborrow for consistency. llvm-svn: 348737
2018-12-09[X86] Add some comments about when some X86 intrinsic autoupgrade code was ↵Craig Topper1-7/+7
added. Someday we'd like to remove old autoupgrade code so it helps to annotate how long its been there so we don't have to go digging through commit history. llvm-svn: 348728
2018-09-07[X86] Modify the the rdtscp intrinsic to return values instead of taking a ↵Craig Topper1-0/+37
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 llvm-svn: 341698
2018-09-07[X86] Change the addcarry and subborrow intrinsics to return 2 results and ↵Craig Topper1-0/+58
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 llvm-svn: 341677
2018-08-23Allow creating llvm::Function in non-zero address spacesAlexander Richardson1-2/+2
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 llvm-svn: 340519
2018-08-16[X86] Remove masking from the 512-bit padds and psubs intrinsics. Use select ↵Craig Topper1-8/+10
in IR instead. llvm-svn: 339842
2018-08-16[X86] Remove the unused masked 128 and 256-bit masked padds/psubs intrinsics.Craig Topper1-12/+42
Still need to remove masking from the 512-bit versions. llvm-svn: 339841
2018-08-14Fix MSVC "compiler limit: blocks nested too deeply" error. NFCI.Simon Pilgrim1-35/+19
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). llvm-svn: 339666
2018-08-14[X86] Lowering addus/subus intrinsics to native IRTomasz Krupa1-2/+47
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 llvm-svn: 339650
2018-07-30Remove trailing spaceFangrui Song1-1/+1
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
2018-07-12[X86] Remove and autoupgrade the scalar fma intrinsics with masking.Craig Topper1-40/+99
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. llvm-svn: 336871
2018-07-06[X86] Remove FMA4 scalar intrinsics. Use llvm.fma intrinsic instead.Craig Topper1-0/+16
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. llvm-svn: 336416
2018-07-06[X86] Remove all of the avx512 masked packed fma intrinsics. Use llvm.fma or ↵Craig Topper1-2/+128
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. llvm-svn: 336409
2018-07-05[X86] Remove the last of the 'x86.fma.' intrinsics and autoupgrade them to ↵Craig Topper1-19/+25
'llvm.fma'. Add upgrade tests for all. Still need to remove the AVX512 masked versions. llvm-svn: 336383
2018-07-05[X86] Remove X86 specific scalar FMA intrinsics and upgrade to tart ↵Craig Topper1-52/+33
independent FMA and extractelement/insertelement. llvm-svn: 336315
2018-07-05[X86] Remove some of the packed FMA3 intrinsics since we no longer use them ↵Craig Topper1-40/+32
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. llvm-svn: 336303
2018-06-30[X86] Remove masking from avx512 rotate intrinsics. Use select in IR instead.Craig Topper1-0/+64
llvm-svn: 336035
2018-06-29[X86] Remove masking from the avx512 packed sqrt intrinsics. Use select in ↵Craig Topper1-8/+15
IR instead. While there improve the coverage of the intrinsic testing and add fast-isel tests. llvm-svn: 335944
2018-06-27[X86] Rename the autoupgraded of packed fp compare and fpclass intrinsics ↵Craig Topper1-111/+65
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". llvm-svn: 335744
2018-06-26[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and ↵Craig Topper1-0/+43
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. llvm-svn: 335568
2018-06-26Revert r335562 and 335563 "[X86] Redefine avx512 packed fpclass intrinsics ↵Craig Topper1-43/+0
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. llvm-svn: 335566
2018-06-26fooCraig Topper1-0/+43
llvm-svn: 335562
2018-06-21[X86] Remove masking from 512-bit floating max/min intrinsics. Use select ↵Craig Topper1-12/+32
instruction instead. llvm-svn: 335199
2018-06-15[X86] Lowering sqrt intrinsics to native IRTomasz Krupa1-0/+32
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 llvm-svn: 334849
2018-06-13[X86] Remove masking from avx512vbmi2 concat and shift by immediate ↵Craig Topper1-0/+44
intrinsics. Use select in IR instead. llvm-svn: 334576
2018-06-11[X86] Remove masking from dbpsadbw intrinsics, use select in IR instead.Craig Topper1-0/+10
llvm-svn: 334384
2018-06-11[X86] Remove and autoupgrade the expandload and compressstore intrinsics.Craig Topper1-0/+32
We use the target independent intrinsics now. llvm-svn: 334381
2018-06-10[X86] Remove masking from the 512-bit masked floating point add/sub/mul/div ↵Craig Topper1-21/+57
intrinsics. Use a select in IR instead. llvm-svn: 334358
2018-06-03[X86] Remove and autoupgrade masked avx512vnni intrinsics using the unmasked ↵Craig Topper1-0/+68
intrinsics and select instructions. llvm-svn: 333857
2018-05-29[X86] Remove masked vpermi2var/vpermt2var intrinsics and autoupgrade.Craig Topper1-0/+64
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. llvm-svn: 333388
2018-05-26[X86] Remove masking from avx512ifma intrinsics. Use a select instead.Craig Topper1-0/+30
This allows us to avoid having mask and maskz variant. Reducing from 12 intrinsics to 6. llvm-svn: 333346
2018-05-21[X86] Remove 128/256-bit cvtdq2ps, cvtudq2ps, cvtqq2pd, cvtuqq2pd intrinsics.Craig Topper1-24/+33
These can all be implemented with sitofp/uitofp instructions. llvm-svn: 332916
2018-05-21[X86] Remove masking from vpternlog intrinsics. Use a select in IR instead.Craig Topper1-0/+30
This removes 6 intrinsics since we no longer need separate mask and maskz intrinsics. Differential Revision: https://reviews.llvm.org/D47124 llvm-svn: 332890
2018-05-20[X86] Remove mask arguments from permvar builtins/intrinsics. Use a select ↵Craig Topper1-6/+34
in IR instead. Someday maybe we'll use selects for all intrinsics. llvm-svn: 332824
2018-05-14[X86] Remove and autoupgrade avx512.vbroadcast.ss/avx512.vbroadcast.sd ↵Craig Topper1-1/+3
intrinsics. llvm-svn: 332271
2018-05-14[X86] Remove and autoupgrade the cvtusi2sd intrinsic. Use ↵Craig Topper1-0/+5
uitofp+insertelement instead. llvm-svn: 332206
2018-05-13[X86] Remove and autoupgrade masked vpermd/vpermps intrinsics.Craig Topper1-7/+13
llvm-svn: 332198
2018-05-13[X86] Remove an autoupgrade legacy cvtss2sd intrinsics.Craig Topper1-0/+5
llvm-svn: 332187
2018-05-12[X86] Remove and autoupgrade cvtsi2ss/cvtsi2sd intrinsics to match what ↵Craig Topper1-0/+11
clang has used for a very long time. llvm-svn: 332186
2018-05-12[X86] Remove some unused masked conversion intrinsics that can be replaced ↵Craig Topper1-3/+33
with an older intrinsic and a select. This is what clang already uses. llvm-svn: 332170
2018-05-11[X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer ↵Craig Topper1-0/+83
used by clang. llvm-svn: 332146
2018-05-11[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.Craig Topper1-0/+11
llvm-svn: 332079
2018-05-03Rename invariant.group.barrier to launder.invariant.groupPiotr Padlewski1-0/+11
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 llvm-svn: 331448
2018-04-26[x86] Revert r330322 (& r330323): Lowering x86 adds/addus/subs/subus intrinsicsChandler Carruth1-104/+2
The LLVM commit introduces a crash in LLVM's instruction selection. I filed http://llvm.org/PR37260 with the test case. llvm-svn: 330997
2018-04-23Fix -Wtautological-compare warning with npos on WindowsReid Kleckner1-2/+1
llvm-svn: 330614
2018-04-19Lowering x86 adds/addus/subs/subus intrinsics (llvm part)Alexander Ivchenko1-2/+104
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 llvm-svn: 330322
2018-04-17[IR] Upgrade comment token in objc retain release marker for asm callGerolf Hoflehner1-0/+13
Older compiler issued '#' instead of ';' llvm-svn: 330173
2018-04-13[X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR.Craig Topper1-18/+45
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. llvm-svn: 329990
2018-04-11[X86] Remove 128/256-bit masked pmaddubsw and pmaddwd intrinsics. Replace ↵Craig Topper1-0/+20
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. llvm-svn: 329774
2018-04-09[X86] Merge some of the autoupgrade handling for masked intrinsics that just ↵Craig Topper1-170/+149
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. llvm-svn: 329549