llvm-project/llvm/test/CodeGen/ARM/pr122670-regression.ll
Matt Arsenault c268a3f093 DAG: Fix extract of load combine with mismatched vector element type
Fix the case where the vector element type of the loaded extractelement
input does not match the result type of the extract.

This fixes a regression reported after
c55a7659b38946350315ac4a18d9805deb1f0a54
2025-02-06 22:56:56 +07:00

21 lines
702 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=armv7-unknown-linux-gnueabihf < %s | FileCheck %s
; Check for assertion when extractelement of load optimization
; involves a result element type different from the input vector
; element type.
define i8 @baz(ptr %ptr, i32 %arg) {
; CHECK-LABEL: baz:
; CHECK: @ %bb.0: @ %bb
; CHECK-NEXT: add r1, r1, r1
; CHECK-NEXT: and r1, r1, #3
; CHECK-NEXT: ldr r0, [r0, r1, lsl #2]
; CHECK-NEXT: bx lr
bb:
%load = load <2 x i64>, ptr %ptr, align 8
%extractelement = extractelement <2 x i64> %load, i32 %arg
%trunc = trunc i64 %extractelement to i8
ret i8 %trunc
}