Skip to content

Conversation

@anoopkg6
Copy link
Contributor

Linux kernel build fails for SystemZ as output of INLINEASM was GR32Bit general-purpose register instead of SystemZ::CC.

anoopkg6 and others added 30 commits February 5, 2025 23:57
… conditional branch for 14 possible combinations of CC mask.
… bound

  for all backend suuporting flag output operand (X86, AARCH64 and SystemZ).
- Remove all changes target specific changes from SelectionDAGBuiler.cpp.
- Added getJumpConditionMergingParams for SystemZ for setting cost for
  merging srl/ipm/cc.
- TODO: Handle the cases where simplifyBranchOnICmpChain creates switch table
  while folding branch on And'd or Or'd chain of icmp instructions.
1. Remove check for CCValid if it has already been combined.
2. Added logic to check if TrueVal/FalseVal of two select_ccmask are matching
   or inverted.
1. Put outer select_ccmask and br_ccmask back to worklist so as to allow
   processing from outer select_ccmask/br_ccmask to combine with
   (icmp (select_ccmask)).
2. Remove combineICMP.
1. Remove combineTM and move code to combineCCMask and combine select_ccmask or
   br_ccmask with (TM (select_ccmask cc-value)). cc-value is (SRL (IPM (CC))).
2. Implement xor (select_ccmask .. CC) cc-value for cases where only one bit is
   set or on clear bit in CCMask.
3. Constrained combineOR, combineXOR and combineAND optimization for
   combinations of TrueVal Vs FalseVal between the select_ccmask.
1. Extend (icmp (select_ccmask .. CC)) to include (tm (select_ccmask .. CC ))
   in combineCCMask.
2. In combineXOR and combineAND modified (TM (select_ccmask cc-value)) and
   (ICMP ((select_ccmask cc-value)) respectively where either one bit is set
   or only one bit is clear.
3. Added compile time evaluation of CCMask for above modified select_ccmask
   when all subexpressions of select_ccmask are either constant or
   (SRL (IPM CC)).
4. Added more constraints to combineOR, combineXOR and combineAND optimization.
2. Refactored combinedOR/combineXOR/combineAND common code into new function
   combineLogicalOpCCMask.
…assumption that CC actually results in the numerical condition code value CCVal, and return vector of CCVals for each position.

2. Implement findCCUse routine that finds a CC that is used as condition code and the associated CCValid mask.
3. Code related to select_ccmask in combineCCMask has been removed, as this computation has been done in new framework.
4. Remove combineLogicalOpCCMask as simplifyAssumingCCVal fully recurses through logical operations.
   findCCUse from simplifyAssumingCCVal.
2. Remove ICMP and TM case from findCCUse.
3. Generaize TrueVal and FalseVal in outermost select_ccmask in
   combineSELECT_CCMASK,
4. Emulating TM for all CCMask.
5. Incorporated other code review feedback.
…Int to

   avoid truncation.
2. Pass DAG instead of DCI to combineCCMask and SimplifyAssumingCCVals, and
   make these functions static instead of SystemZTargetLowering member function.
3. Treat SRL, SRA, SHL like other binary operators, and remove check for
   constant. This makes it even more generalized.
4. ADD, OR, XOR, AND, and SRA might clobber CC, added check hasOneUse().
5. Incorporated other code review feedback.
anoopkg6 and others added 25 commits August 27, 2025 00:35
…and()

2. Change setOutputOperand() implementation by directly setting ImmRange fields
   Min/Max/isConstrainedlds.
2. Ignore git-clang-format one error in SystemZISelLowering.cpp in this commit.
…nstraint.

2. Removed flag_output_operand_cc*.
3. Renamed systemz_asm_flag_outut.c to systemz_asm_flag_output.c.
…porary

   created from CopyFromReg.
2. Modify the select_ccmask test cases.
… output of

INLINEASM is GR32Bit general-purpose register. It should be SystemZ::CC instead.
Copy link
Member

@uweigand uweigand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@uweigand uweigand merged commit 242c716 into llvm:main Oct 27, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 27, 2025

LLVM Buildbot has detected a new failure on builder openmp-s390x-linux running on systemz-1 while building llvm at step 6 "test-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/17559

Here is the relevant piece of the build log for the reference
Step 6 (test-openmp) failure: test (failure)
******************** TEST 'libomp :: tasking/issue-94260-2.c' FAILED ********************
Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp   -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic && /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang -fopenmp -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test -L /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -fno-omit-frame-pointer -mbackchain -I /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c -o /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp -lm -latomic
# executed command: /home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--

********************


dvbuka pushed a commit to dvbuka/llvm-project that referenced this pull request Oct 27, 2025
Linux kernel build fails for SystemZ as output of INLINEASM was GR32Bit
general-purpose register instead of SystemZ::CC.

---------

Co-authored-by: anoopkg6 <anoopkg6@github.com>
Co-authored-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants