[llvm] [SPIRV] Sign-extend operands of sign-sensitive ops on sub-pow2 widths (PR #203661)

Faijul Amin via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 11 10:38:23 PDT 2026


================
@@ -0,0 +1,146 @@
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -verify-machineinstrs -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -verify-machineinstrs -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
+
+; SPIR-V (without sub-byte int extensions) widens sub-pow2 scalars to the next
+; legal width by relabeling the LLT only, without inserting any sign-extension.
+; Sign-sensitive ops (icmp slt/sle/sgt/sge, ashr, sdiv, srem) on such operands
----------------
mdfaijul wrote:

I have added tests for sgt/sge/sle
https://github.com/llvm/llvm-project/pull/203661/changes#diff-8bd0de1f8066e1ca10d237ba6aff85caec49be239f63fd0cf41ebcc15bfb69a2R35-R77

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


More information about the llvm-commits mailing list