When extracting a smaller integer from a scalar_to_vector source, we were limited to only folding/truncating the lowest bits of the scalar source. This patch extends the fold to handle extraction of any other element, by right shifting the source before truncation. Fixes a regression from #117884
39 lines
1.5 KiB
LLVM
39 lines
1.5 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc -mcpu=pwr9 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
|
|
; RUN: -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P9LE
|
|
; RUN: llc -mcpu=pwr9 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
|
|
; RUN: -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P9BE
|
|
; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
|
|
; RUN: -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P8LE
|
|
; RUN: llc -mcpu=pwr8 -verify-machineinstrs -ppc-vsr-nums-as-vr -ppc-asm-full-reg-names \
|
|
; RUN: -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s --check-prefix=P8BE
|
|
|
|
define i8 @scalar_to_vector_half(ptr nocapture readonly %ad) {
|
|
; P9LE-LABEL: scalar_to_vector_half:
|
|
; P9LE: # %bb.0: # %entry
|
|
; P9LE-NEXT: lhz r3, 0(r3)
|
|
; P9LE-NEXT: blr
|
|
;
|
|
; P9BE-LABEL: scalar_to_vector_half:
|
|
; P9BE: # %bb.0: # %entry
|
|
; P9BE-NEXT: lhz r3, 0(r3)
|
|
; P9BE-NEXT: srwi r3, r3, 24
|
|
; P9BE-NEXT: blr
|
|
;
|
|
; P8LE-LABEL: scalar_to_vector_half:
|
|
; P8LE: # %bb.0: # %entry
|
|
; P8LE-NEXT: lhz r3, 0(r3)
|
|
; P8LE-NEXT: blr
|
|
;
|
|
; P8BE-LABEL: scalar_to_vector_half:
|
|
; P8BE: # %bb.0: # %entry
|
|
; P8BE-NEXT: lhz r3, 0(r3)
|
|
; P8BE-NEXT: srwi r3, r3, 24
|
|
; P8BE-NEXT: blr
|
|
entry:
|
|
%0 = load <2 x i8>, ptr %ad, align 1
|
|
%1 = extractelement <2 x i8> %0, i32 0
|
|
ret i8 %1
|
|
}
|
|
|