[llvm] [X86] Optimize (a & 0xff) | ((b & 0xff) << 8) into high-byte register insertions (PR #214645)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 09:55:51 PDT 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 139435 tests passed
* 3644 tests skipped
* 2 tests failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.CodeGen/X86/extract-bits.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=i686-unknown-linux-gnu -mattr=-bmi,-tbm,-bmi2,+fast-bextr < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll --check-prefixes=X86,X86-NOBMI
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=i686-unknown-linux-gnu -mattr=-bmi,-tbm,-bmi2,+fast-bextr
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll' --check-prefixes=X86,X86-NOBMI
# note: command had no output on stdout or stderr
# RUN: at line 3
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mtriple=i686-unknown-linux-gnu -mattr=+bmi,-tbm,-bmi2,+fast-bextr < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll --check-prefixes=X86,X86-BMINOTBM,X86-BMI1
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=i686-unknown-linux-gnu -mattr=+bmi,-tbm,-bmi2,+fast-bextr
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll' --check-prefixes=X86,X86-BMINOTBM,X86-BMI1
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:52:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:11:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:9:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:10:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:183:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:40:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:38:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:39:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:250:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:55:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:53:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:54:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:319:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:70:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:68:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:69:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:387:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:84:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:82:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:83:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:462:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl %al, %edx
# |                  ^
# | <stdin>:101:2: note: 'next' match was here
# |  movzbl %al, %edx
# |  ^
# | <stdin>:99:21: note: previous match ended here
# |  movl 20(%esp), %eax
# |                     ^
# | <stdin>:100:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2228:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:581:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:579:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:580:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2292:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:595:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:593:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:594:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2359:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:610:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:608:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:609:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2428:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:625:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:623:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:624:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2496:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:639:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:637:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:638:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:2571:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl %al, %edx
# |                  ^
# | <stdin>:656:2: note: 'next' match was here
# |  movzbl %al, %edx
# |  ^
# | <stdin>:654:21: note: previous match ended here
# |  movl 20(%esp), %eax
# |                     ^
# | <stdin>:655:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:6543:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:1654:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:1652:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:1653:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:6604:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %ecx
# |                  ^
# | <stdin>:1668:2: note: 'next' match was here
# |  movzbl 8(%esp), %ecx
# |  ^
# | <stdin>:1666:23: note: previous match ended here
# |  movzbl 12(%esp), %eax
# |                       ^
# | <stdin>:1667:1: note: non-matching line after previous match is here
# |  shll $8, %eax
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:6669:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:1683:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:1681:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:1682:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:6734:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl {{[0-9]+}}(%esp), %edx
# |                  ^
# | <stdin>:1698:2: note: 'next' match was here
# |  movzbl 8(%esp), %edx
# |  ^
# | <stdin>:1696:23: note: previous match ended here
# |  movzbl 12(%esp), %ecx
# |                       ^
# | <stdin>:1697:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll:6810:18: error: X86-BMI1-NEXT: is not on the line after the previous match
# | ; X86-BMI1-NEXT: movzbl %al, %edx
# |                  ^
# | <stdin>:1715:2: note: 'next' match was here
# |  movzbl %al, %edx
# |  ^
# | <stdin>:1713:21: note: previous match ended here
# |  movl 20(%esp), %eax
# |                     ^
# | <stdin>:1714:1: note: non-matching line after previous match is here
# |  shll $8, %ecx
# | ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\extract-bits.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |              1:  .att_syntax 
# |              2:  .file "<stdin>" 
# |              3:  .text 
# |              4:  .globl bextr32_a0 # -- Begin function bextr32_a0 
# |              5:  .prefalign 4, .Lfunc_end0, nop 
# |              6:  .type bextr32_a0, at function 
# |              7: bextr32_a0: # @bextr32_a0 
# |              8: # %bb.0: 
# |              9:  movzbl 12(%esp), %eax 
# | next:52'0                            {   search range start (exclusive)
# |             10:  shll $8, %eax 
# |             11:  movzbl 8(%esp), %ecx 
# | next:52'1        !~~~~~~~~~~~~~~~~~~~   error: match on wrong line
# |             12:  orl %eax, %ecx 
# |             13:  bextrl %ecx, 4(%esp), %eax 
# |             14:  retl 
# |             15: .Lfunc_end0: 
# |             16:  .size bextr32_a0, .Lfunc_end0-bextr32_a0 
# |             17:  # -- End function 
# |             18:  .globl bextr32_a0_arithmetic # -- Begin function bextr32_a0_arithmetic 
# |             19:  .prefalign 4, .Lfunc_end1, nop 
# |             20:  .type bextr32_a0_arithmetic, at function 
# |             21: bextr32_a0_arithmetic: # @bextr32_a0_arithmetic 
# | next:52'2                             }                           search range end (exclusive)
# |             22: # %bb.0: 
# |             23:  movzbl 12(%esp), %eax 
# |             24:  movzbl 8(%esp), %ecx 
# |             25:  movl 4(%esp), %edx 
# |             26:  sarl %cl, %edx 
# |              .
# |              .
# |              .
# |             33:  .globl bextr32_a1_indexzext # -- Begin function bextr32_a1_indexzext 
# |             34:  .prefalign 4, .Lfunc_end2, nop 
# |             35:  .type bextr32_a1_indexzext, at function 
# |             36: bextr32_a1_indexzext: # @bextr32_a1_indexzext 
# |             37: # %bb.0: 
# |             38:  movzbl 12(%esp), %eax 
# | next:183'0                           {   search range start (exclusive)
# |             39:  shll $8, %eax 
# |             40:  movzbl 8(%esp), %ecx 
# | next:183'1       !~~~~~~~~~~~~~~~~~~~   error: match on wrong line
# |             41:  orl %eax, %ecx 
# |             42:  bextrl %ecx, 4(%esp), %eax 
# |             43:  retl 
# |             44: .Lfunc_end2: 
# |             45:  .size bextr32_a1_indexzext, .Lfunc_end2-bextr32_a1_indexzext 
# |             46:  # -- End function 
# |             47:  .globl bextr32_a2_load # -- Begin function bextr32_a2_load 
# |             48:  .prefalign 4, .Lfunc_end3, nop 
# |           
# | ...
# `---data was truncated (10240/25201) (change limit with -D output_limit=N)
# error: command failed with exit status: 1

--

```
</details>
<details>
<summary>LLVM.CodeGen/X86/h-register-insert.ll</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 2
c:\_work\llvm-project\llvm-project\build\bin\llc.exe < C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\h-register-insert.ll -mtriple=i686-unknown-unknown | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\h-register-insert.ll --check-prefix=X86
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mtriple=i686-unknown-unknown
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\h-register-insert.ll' --check-prefix=X86
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\h-register-insert.ll:117:13: error: X86-NEXT: expected string not found in input
# | ; X86-NEXT: movl %eax, %ecx
# |             ^
# | <stdin>:80:9: note: scanning from here
# | # %bb.0:
# |         ^
# | <stdin>:82:3: note: possible intended match here
# |  testl %eax, %eax
# |   ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\CodeGen\X86\h-register-insert.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            75:  .globl test_insert_shared_lo # -- Begin function test_insert_shared_lo 
# |            76:  .prefalign 4, .Lfunc_end5, nop 
# |            77:  .type test_insert_shared_lo, at function 
# |            78: test_insert_shared_lo: # @test_insert_shared_lo 
# |            79:  .cfi_startproc 
# |            80: # %bb.0: 
# | next:117'0            {   search range start (exclusive)
# | next:117'1                error: no match found in search range
# |            81:  movzbl %al, %eax 
# |            82:  testl %eax, %eax 
# | next:117'2       ?                 possible intended match
# |            83:  je .LBB5_2 
# |            84: # %bb.1: 
# |            85:  movb %dl, %ah 
# |            86: .LBB5_2: 
# |            87:  retl 
# |            88: .Lfunc_end5: 
# |            89:  .size test_insert_shared_lo, .Lfunc_end5-test_insert_shared_lo 
# |            90:  .cfi_endproc 
# |            91:  # -- End function 
# |            92:  .section ".note.GNU-stack","", at progbits 
# | next:117'3                                              } search range end (exclusive)
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list