summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
AgeCommit message (Collapse)Author
2025-06-29[Target] Prevent copying in loop variables (NFC)Jie Fu
/data/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:2390:19: error: loop variable '[Reg, N]' creates a copy from type 'std::pair<unsigned int, llvm::SDValue> const' [-Werror,-Wrange-loop-construct] for (const auto [Reg, N] : RegsToPass) { ^ /data/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:2390:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying for (const auto [Reg, N] : RegsToPass) { ^~~~~~~~~~~~~~~~~~~~~ & /data/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:2402:19: error: loop variable '[Reg, N]' creates a copy from type 'std::pair<unsigned int, llvm::SDValue> const' [-Werror,-Wrange-loop-construct] for (const auto [Reg, N] : RegsToPass) ^ /data/llvm-project/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:2402:8: note: use reference type 'std::pair<unsigned int, llvm::SDValue> const &' to prevent copying for (const auto [Reg, N] : RegsToPass) ^~~~~~~~~~~~~~~~~~~~~ & 2 errors generated.
2025-06-28[Target] Use range-based for loops (NFC) (#146253)Kazu Hirata
2025-06-23CodeGen: Emit error if getRegisterByName fails (#145194)Matt Arsenault
This avoids using report_fatal_error and standardizes the error message in a subset of the error conditions.
2025-06-11Reland "[SelectionDAG] Make `(a & x) | (~a & y) -> (a & (x ^ y)) ^ y` ↵Iris Shi
available for all targets" (#143651)
2025-06-11Revert "[SelectionDAG] Make `(a & x) | (~a & y) -> (a & (x ^ y)) ^ y` ↵Iris Shi
available for all targets" (#143648)
2025-06-09[SelectionDAG] Make `(a & x) | (~a & y) -> (a & (x ^ y)) ^ y` available for ↵Iris Shi
all targets (#137641)
2025-06-04SystemZ: Move runtime libcall setting out of TargetLowering (#142622)Matt Arsenault
RuntimeLibcallInfo needs to be correct outside of codegen contexts.
2025-05-23[NFC][CodeGen] Adopt MachineFunctionProperties convenience accessors (#141101)Rahul Joshi
2025-05-16[SelectionDAG] Rename MemSDNode::getOriginalAlign to getBaseAlign. NFC (#139930)Craig Topper
This matches the underlying function in MachineMemOperand and how it is printed when BaseAlign differs from Align.
2025-04-24[SystemZ] Add DAGCombine for FCOPYSIGN to remove rounding. (#136131)Jonas Paulsson
Add a DAGCombine for FCOPYSIGN that removes the rounding which is never needed as the sign bit is already in the correct place. This helps in particular the rounding to f16 case which needs a libcall. Also remove the roundings for other FP VTs and simplify the CPSDR patterns correspondingly. fp-copysign-03.ll test updated, now also covering the other FP VT combinations.
2025-04-24[SystemZ] Handle f16 load positive/negative/complement without libcalls. ↵Jonas Paulsson
(#136286) This can be done directly with the (64-bit) target instruction as only the sign bit is changed.
2025-04-22[SelectionDAG] Pass LoadExtType when ATOMIC_LOAD is created. (#136653)Craig Topper
Rename one signature of getAtomic to getAtomicLoad and pass LoadExtType. Previously we had to set the extension type after the node was created, but we don't usually modify SDNodes once they are created. It's possible the node already existed and has been CSEd. If that happens, modifying the node may affect the other users. It's therefore safer to add the extension type at creation so that it is part of the CSE information. I don't know of any failures related to the current implementation. I only noticed that it doesn't match how we usually do things.
2025-04-16[SystemZ] Fix warningsKazu Hirata
This patch fixes: llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:6916:7: error: unused variable 'RegVT' [-Werror,-Wunused-variable] llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp:1265:30: error: unused variable 'RC' [-Werror,-Wunused-variable]
2025-04-16[SystemZ] Add support for 16-bit floating point. (#109164)Jonas Paulsson
- _Float16 is now accepted by Clang. - The half IR type is fully handled by the backend. - These values are passed in FP registers and converted to/from float around each operation. - Compiler-rt conversion functions are now built for s390x including the missing extendhfdf2 which was added. Fixes #50374
2025-04-11Support z17 processor name and scheduler description (#135254)Ulrich Weigand
The recently announced IBM z17 processor implements the architecture already supported as "arch15" in LLVM. This patch adds support for "z17" as an alternate architecture name for arch15. This patch also add the scheduler description for the z17 processor, provided by Jonas Paulsson.
2025-03-21[SystemZ] Use hasAddressTaken() with verifyNarrowIntegerArgs (NFC). (#131039)Jonas Paulsson
Use hasAddressTaken() in SystemZ instead of doing this computation in isFullyInternal(), and make sure to only do this once per Function.
2025-03-15[SystemZ] Implement i128 funnel shiftsUlrich Weigand
These can be handled via the VECTOR SHIFT LEFT/RIGHT DOUBLE family of instructions, depending on architecture level. Fixes: https://github.com/llvm/llvm-project/issues/129955
2025-03-15[SystemZ] Recognize carry/borrow computationUlrich Weigand
Generate code using the VECTOR ADD COMPUTE CARRY and VECTOR SUBTRACT COMPUTE BORROW INDICATION instructions to implement open-coded IR with those semantics. Handles integer vector types as well as i128. Fixes: https://github.com/llvm/llvm-project/issues/129608
2025-03-15[SystemZ] Optimize vector zero/sign extensionsUlrich Weigand
Generate more efficient code for zero or sign extensions where the source is a subvector generated via SHUFFLE_VECTOR. Specifically, recognize patterns corresponding to (series of) VECTOR UNPACK instructions, or the VECTOR SIGN EXTEND TO DOUBLEWORD instruction. As a special case, also handle zero or sign extensions of a vector element to i128. Fixes: https://github.com/llvm/llvm-project/issues/129576 Fixes: https://github.com/llvm/llvm-project/issues/129899
2025-03-15[SystemZ] Optimize widening and high-word vector multiplicationUlrich Weigand
Detect (non-intrinsic) IR patterns corresponding to the semantics of the various widening and high-word multiplication instructions. Specifically, this is done by: - Recognizing even/odd widening multiplication patterns in DAGCombine - Recognizing widening multiply-and-add on top during ISel - Implementing the standard MULHS/MUHLU IR opcodes - Detecting high-word multiply-and-add (which common code does not) Depending on architecture level, this can support all integer vector types as well as the scalar i128 type. Fixes: https://github.com/llvm/llvm-project/issues/129705
2025-03-15[SystemZ] Optimize vector comparison reductionsUlrich Weigand
Generate efficient code using the condition code set by the VECTOR (FP) COMPARE family of instructions to implement vector comparison reductions, e.g. as resulting from __builtin_reduce_and/or of some vector comparsion. Fixes: https://github.com/llvm/llvm-project/issues/129434
2025-03-12[SystemZ] Move disabling of arg verification to before isFullyInternal(). ↵Jonas Paulsson
(#130693) It has found to be quite a slowdown to traverse the users of a function from each call site when it is called many (~70k) times. This patch fixes this for now as long as this verification is disabled by default, but there is still a need to eventually cache the results to avoid recomputation. Fixes #130541
2025-02-14[SystemZ] Add codegen support for llvm.roundevenUlrich Weigand
This is straightforward as we already had all the necessary instructions, they simply were not wired up. Also allows implementing the vec_round intrinsic via the standard llvm.roundeven IR instead of a platform intrinsic now.
2025-02-06[SystemZ] Avoid repeated hash lookups (NFC) (#126005)Kazu Hirata
Co-authored-by: Nikita Popov <github@npopov.com>
2025-01-23[SystemZ] Fix ICE with i128->i64 uaddo carry chainUlrich Weigand
We can only optimize a uaddo_carry via specialized instruction if the carry was produced by another uaddo(_carry) instruction; there is already a check for that. However, i128 uaddo(_carry) use a completely different mechanism; they indicate carry in a vector register instead of the CC flag. Thus, we must also check that we don't mix those two - that check has been missing. Fixes: https://github.com/llvm/llvm-project/issues/124001
2025-01-20[SystemZ] Add support for new cpu architecture - arch15Ulrich Weigand
This patch adds support for the next-generation arch15 CPU architecture to the SystemZ backend. This includes: - Basic support for the new processor and its features. - Detection of arch15 as host processor. - Assembler/disassembler support for new instructions. - Exploitation of new instructions for code generation. - New vector (signed|unsigned|bool) __int128 data types. - New LLVM intrinsics for certain new instructions. - Support for low-level builtins mapped to new LLVM intrinsics. - New high-level intrinsics in vecintrin.h. - Indicate support by defining __VEC__ == 10305. Note: No currently available Z system supports the arch15 architecture. Once new systems become available, the official system name will be added as supported -march name.
2025-01-20[Mips] Fix compiler crash when returning fp128 after calling a functi… ↵yingopq
(#117525) …on returning { i8, i128 } Fixes https://github.com/llvm/llvm-project/issues/96432.
2024-12-19[SelectionDAG] Split SDNode::use_iterator into user_iterator and ↵Craig Topper
use_iterator. (#120531) SDNode::use_iterator now returns an SDUse& when dereferenced. SDNode::user_iterator returns SDNode*. SDNode::use_begin/use_end/uses work on use_iterator. SDNode::user_begin/user_end/users work on user_iterator. We can now write range based for loops using SDUse& and SDNode::uses(). I've converted many of these in this patch. I didn't update loops that have additional variables updated in their for statement. Some loops use SDNode::use_iterator::getOperandNo() which also prevents using range based for loops. I plan to move this into SDUse in a follow up patch.
2024-12-18[SelectionDAG] Add SDNode::user_begin() and use it in some places (#120509)Craig Topper
Most of these are just places that want the first user and aren't iterating over the whole list. While there I changed some use_size() == 1 to hasOneUse() which is more efficient. This is part of an effort to rename use_iterator to user_iterator and provide a use_iterator that dereferences to SDUse&. This patch helps reduce the diff on later patches.
2024-12-18[SelectionDAG] Rename SDNode::uses() to users(). (#120499)Craig Topper
This function is most often used in range based loops or algorithms where the iterator is implicitly dereferenced. The dereference returns an SDNode * of the user rather than SDUse * so users() is a better name. I've long beeen annoyed that we can't write a range based loop over SDUse when we need getOperandNo. I plan to rename use_iterator to user_iterator and add a use_iterator that returns SDUse& on dereference. This will make it more like IR.
2024-12-10SystemZ: Add support for __builtin_setjmp and __builtin_longjmp. (#119257)anoopkg6
This pr includes fixes for original pr##116642. Implementation for __builtin_setjmp and __builtin_longjmp for SystemZ..
2024-12-07Revert "[SystemZ] Add support for __builtin_setjmp and __builtin_longjmp ↵Ulrich Weigand
(#116642)" This reverts commit 030bbc92a705758f1131fb29cab5be6d6a27dd1f.
2024-12-07Revert "[SystemZ] Fix a warning"Ulrich Weigand
This reverts commit 3c47e63723b1aa9e76f30fc8d1acef9caf4ea783.
2024-12-06[SystemZ] Fix a warningKazu Hirata
This patch fixes: llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:953:30: error: unused variable 'TRI' [-Werror,-Wunused-variable]
2024-12-06[SystemZ] Add support for __builtin_setjmp and __builtin_longjmp (#116642)anoopkg6
Implementation for __builtin_setjmp and __builtin_longjmp for SystemZ.
2024-12-03[TargetLowering] Use Type* instead of EVT in shouldSignExtendTypeInLibCall. ↵Craig Topper
(#118587) I want to use this function for GISel too so Type * is a better common interface. All of the callers already convert EVT to Type * as needed by calling lowering anyway.
2024-11-25[SystemZ] Use getSignedConstant() where necessary (#117181)Nikita Popov
This will avoid assertion failures once we disable implicit truncation in getConstant(). Inside adjustSubwordCmp() I ended up suppressing the issue with an explicit cast, because this code deals with a mix of unsigned and signed immediates.
2024-11-11[SystemZ] Fix bitwidth problem in FindReplicatedImm(). (#115383)Jonas Paulsson
A test case emerged with an i32 truncating store of an i64 constant operand, where the i64 constant did not fit in 32 bits, which caused FindReplicatedImm() to crash. Make sure to truncate the APInt in these cases.
2024-10-31[SDAG] Simplify `SDNodeFlags` with bitwise logic (#114061)Yingwei Zheng
This patch allows using enumeration values directly and simplifies the implementation with bitwise logic. It addresses the comment in https://github.com/llvm/llvm-project/pull/113808#discussion_r1819923625.
2024-10-28[SystemZ] Silence compiler warning (#113894)Jonas Paulsson
Use SystemZ::NoRegister instead of 0 in SystemZTargetLowering::getRegisterByName().
2024-10-19[llvm] Ensure that soft float targets don't emit `fma()` libcalls. (#106615)Alex Rønne Petersen
The previous behavior could be harmful in some edge cases, such as emitting a call to `fma()` in the `fma()` implementation itself. Do this by just being more accurate in `isFMAFasterThanFMulAndFAdd()`. This was already done for PowerPC; this commit just extends that to Arm, z/Arch, and x86. MIPS and SPARC already got it right, but I added tests for them too, for good measure. Note: I don't have commit access.
2024-10-16[SystemZ] Add missing newline character in verifyNarrowIntegerArgs_Call(). ↵Jonas Paulsson
(#112499)
2024-10-12[SystemZ] Avoid repeated hash lookups (NFC) (#112072)Kazu Hirata
2024-09-30[SystemZ] Fix a warningKazu Hirata
This patch fixes: llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:9858:18: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]
2024-09-30[SystemZ] Dump function signature on missing arg extension. (#109699)Jonas Paulsson
Make it easier to handle detected problems by providing the function signature(s) involved in cases of missing argument extensions.
2024-09-25Fix for logic in combineExtract() (#108208)Jonas Paulsson
A (csmith) test case appeared where combineExtract() crashed when the input vector was a bitcast into a vector of i1:s. Fix this by adding a check with canTreatAsByteVector() before the call.
2024-09-19[SystemZ] Fix a warningKazu Hirata
This patch fixes: llvm/lib/Target/SystemZ/SystemZISelLowering.cpp:9857:21: error: unused variable 'Flags' [-Werror,-Wunused-variable]
2024-09-19Target ABI: improve call parameters extensions handling (#100757)Jonas Paulsson
For the purpose of verifying proper arguments extensions per the target's ABI, introduce the NoExt attribute that may be used by a target when neither sign- or zeroextension is required (e.g. with a struct in register). The purpose of doing so is to be able to verify that there is always one of these attributes present and by this detecting cases where sign/zero extension is actually missing. As a first step, this patch has the verification step done for the SystemZ backend only, but left off by default until all known issues have been addressed. Other targets/front-ends can now also add NoExt attribute where needed and do this check in the backend.
2024-09-05[SystemZ] Use APInt::getAllOnes()Nikita Popov
This was using -1 without setting the signed flag. Split off from https://github.com/llvm/llvm-project/pull/80309.
2024-08-14[SystemZ][z/OS] Continuation of __ptr32 support (#103393)Abhina Sree
This is a continuation of the __ptr32 support added here https://github.com/llvm/llvm-project/commit/135fecd4441068667ef23f56098befd0c42f89f2