diff options
author | zGoldthorpe <zgoldtho@ualberta.ca> | 2025-07-30 10:58:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-30 10:58:49 -0600 |
commit | 71d6762309a7db67770bdbd39572ef04e6a1ea59 (patch) | |
tree | e1e46605f607ef7ca6c68167a0af840ad4a9d894 /lldb/unittests/ScriptInterpreter/Python | |
parent | c1968fee972859dfd03a7e698422e18a5bc1d478 (diff) | |
download | llvm-71d6762309a7db67770bdbd39572ef04e6a1ea59.zip llvm-71d6762309a7db67770bdbd39572ef04e6a1ea59.tar.gz llvm-71d6762309a7db67770bdbd39572ef04e6a1ea59.tar.bz2 |
[InstCombine] Added pattern for recognising the construction of packed integers. (#147414)
This patch extends the instruction combiner to simplify the construction
of a packed scalar integer from a vector type, such as:
```llvm
target datalayout = "e"
define i32 @src(<4 x i8> %v) {
%v.0 = extractelement <4 x i8> %v, i32 0
%z.0 = zext i8 %v.0 to i32
%v.1 = extractelement <4 x i8> %v, i32 1
%z.1 = zext i8 %v.1 to i32
%s.1 = shl i32 %z.1, 8
%x.1 = or i32 %z.0, %s.1
%v.2 = extractelement <4 x i8> %v, i32 2
%z.2 = zext i8 %v.2 to i32
%s.2 = shl i32 %z.2, 16
%x.2 = or i32 %x.1, %s.2
%v.3 = extractelement <4 x i8> %v, i32 3
%z.3 = zext i8 %v.3 to i32
%s.3 = shl i32 %z.3, 24
%x.3 = or i32 %x.2, %s.3
ret i32 %x.3
}
; ===============
define i32 @tgt(<4 x i8> %v) {
%x.3 = bitcast <4 x i8> %v to i32
ret i32 %x.3
}
```
Alive2 proofs (little-endian):
[YKdMeg](https://alive2.llvm.org/ce/z/YKdMeg)
Alive2 proofs (big-endian):
[vU6iKc](https://alive2.llvm.org/ce/z/vU6iKc)
Diffstat (limited to 'lldb/unittests/ScriptInterpreter/Python')
0 files changed, 0 insertions, 0 deletions