[llvm] [SPIR-V] Sign extend narrow G_SMIN/G_SMAX operands and mask sign sensitive results (PR #226957)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 03:56:53 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: Akhil Goel (akhilgoe)

<details>
<summary>Changes</summary>

This PR includes `G_SMIN` and `G_SMAX` to the list of sign sensitive ops. It also masks the result of the sign sensitive ops to their original widths with a bitwise AND because the later users assume the upper bits are zero and without masking they read the wrong value.

---
Full diff: https://github.com/llvm/llvm-project/pull/226957.diff


2 Files Affected:

- (modified) llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp (+26-6) 
- (modified) llvm/test/CodeGen/SPIRV/legalization/signed-narrow-int.ll (+53-1) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


https://github.com/llvm/llvm-project/pull/226957


More information about the llvm-commits mailing list