[RISCV] Update extractelt tests to sign-extend results (NFC)

This demonstrates a missed optimization: the `vmv.x.s` instruction is
used to extract the element from the vector, and this instruction
already sign-extends the value to XLEN.
This commit is contained in:
Fraser Cormack 2021-01-30 15:47:16 +00:00
parent d221406875
commit c87dd614fd
2 changed files with 264 additions and 93 deletions

View File

@ -2,417 +2,495 @@
; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \ ; RUN: llc -mtriple=riscv32 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=ilp32d \
; RUN: -verify-machineinstrs < %s | FileCheck %s ; RUN: -verify-machineinstrs < %s | FileCheck %s
define i8 @extractelt_nxv1i8_0(<vscale x 1 x i8> %v) { define signext i8 @extractelt_nxv1i8_0(<vscale x 1 x i8> %v) {
; CHECK-LABEL: extractelt_nxv1i8_0: ; CHECK-LABEL: extractelt_nxv1i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 0 %r = extractelement <vscale x 1 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv1i8_imm(<vscale x 1 x i8> %v) { define signext i8 @extractelt_nxv1i8_imm(<vscale x 1 x i8> %v) {
; CHECK-LABEL: extractelt_nxv1i8_imm: ; CHECK-LABEL: extractelt_nxv1i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 2 %r = extractelement <vscale x 1 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv1i8_idx(<vscale x 1 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv1i8_idx(<vscale x 1 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv1i8_idx: ; CHECK-LABEL: extractelt_nxv1i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 %idx %r = extractelement <vscale x 1 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_0(<vscale x 2 x i8> %v) { define signext i8 @extractelt_nxv2i8_0(<vscale x 2 x i8> %v) {
; CHECK-LABEL: extractelt_nxv2i8_0: ; CHECK-LABEL: extractelt_nxv2i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 0 %r = extractelement <vscale x 2 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_imm(<vscale x 2 x i8> %v) { define signext i8 @extractelt_nxv2i8_imm(<vscale x 2 x i8> %v) {
; CHECK-LABEL: extractelt_nxv2i8_imm: ; CHECK-LABEL: extractelt_nxv2i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 2 %r = extractelement <vscale x 2 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_idx(<vscale x 2 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv2i8_idx(<vscale x 2 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv2i8_idx: ; CHECK-LABEL: extractelt_nxv2i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 %idx %r = extractelement <vscale x 2 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_0(<vscale x 4 x i8> %v) { define signext i8 @extractelt_nxv4i8_0(<vscale x 4 x i8> %v) {
; CHECK-LABEL: extractelt_nxv4i8_0: ; CHECK-LABEL: extractelt_nxv4i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 0 %r = extractelement <vscale x 4 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_imm(<vscale x 4 x i8> %v) { define signext i8 @extractelt_nxv4i8_imm(<vscale x 4 x i8> %v) {
; CHECK-LABEL: extractelt_nxv4i8_imm: ; CHECK-LABEL: extractelt_nxv4i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 2 %r = extractelement <vscale x 4 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_idx(<vscale x 4 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv4i8_idx(<vscale x 4 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv4i8_idx: ; CHECK-LABEL: extractelt_nxv4i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 %idx %r = extractelement <vscale x 4 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_0(<vscale x 8 x i8> %v) { define signext i8 @extractelt_nxv8i8_0(<vscale x 8 x i8> %v) {
; CHECK-LABEL: extractelt_nxv8i8_0: ; CHECK-LABEL: extractelt_nxv8i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 0 %r = extractelement <vscale x 8 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_imm(<vscale x 8 x i8> %v) { define signext i8 @extractelt_nxv8i8_imm(<vscale x 8 x i8> %v) {
; CHECK-LABEL: extractelt_nxv8i8_imm: ; CHECK-LABEL: extractelt_nxv8i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 2 %r = extractelement <vscale x 8 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_idx(<vscale x 8 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv8i8_idx(<vscale x 8 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv8i8_idx: ; CHECK-LABEL: extractelt_nxv8i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 %idx %r = extractelement <vscale x 8 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_0(<vscale x 16 x i8> %v) { define signext i8 @extractelt_nxv16i8_0(<vscale x 16 x i8> %v) {
; CHECK-LABEL: extractelt_nxv16i8_0: ; CHECK-LABEL: extractelt_nxv16i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 0 %r = extractelement <vscale x 16 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_imm(<vscale x 16 x i8> %v) { define signext i8 @extractelt_nxv16i8_imm(<vscale x 16 x i8> %v) {
; CHECK-LABEL: extractelt_nxv16i8_imm: ; CHECK-LABEL: extractelt_nxv16i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu
; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vslidedown.vi v26, v8, 2
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 2 %r = extractelement <vscale x 16 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_idx(<vscale x 16 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv16i8_idx(<vscale x 16 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv16i8_idx: ; CHECK-LABEL: extractelt_nxv16i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu
; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vslidedown.vx v26, v8, a0
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 %idx %r = extractelement <vscale x 16 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_0(<vscale x 32 x i8> %v) { define signext i8 @extractelt_nxv32i8_0(<vscale x 32 x i8> %v) {
; CHECK-LABEL: extractelt_nxv32i8_0: ; CHECK-LABEL: extractelt_nxv32i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 0 %r = extractelement <vscale x 32 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_imm(<vscale x 32 x i8> %v) { define signext i8 @extractelt_nxv32i8_imm(<vscale x 32 x i8> %v) {
; CHECK-LABEL: extractelt_nxv32i8_imm: ; CHECK-LABEL: extractelt_nxv32i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu
; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vslidedown.vi v28, v8, 2
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 2 %r = extractelement <vscale x 32 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_idx(<vscale x 32 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv32i8_idx(<vscale x 32 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv32i8_idx: ; CHECK-LABEL: extractelt_nxv32i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu
; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vslidedown.vx v28, v8, a0
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 %idx %r = extractelement <vscale x 32 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_0(<vscale x 64 x i8> %v) { define signext i8 @extractelt_nxv64i8_0(<vscale x 64 x i8> %v) {
; CHECK-LABEL: extractelt_nxv64i8_0: ; CHECK-LABEL: extractelt_nxv64i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 0 %r = extractelement <vscale x 64 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_imm(<vscale x 64 x i8> %v) { define signext i8 @extractelt_nxv64i8_imm(<vscale x 64 x i8> %v) {
; CHECK-LABEL: extractelt_nxv64i8_imm: ; CHECK-LABEL: extractelt_nxv64i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu
; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vslidedown.vi v8, v8, 2
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 2 %r = extractelement <vscale x 64 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_idx(<vscale x 64 x i8> %v, i32 %idx) { define signext i8 @extractelt_nxv64i8_idx(<vscale x 64 x i8> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv64i8_idx: ; CHECK-LABEL: extractelt_nxv64i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu
; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 24
; CHECK-NEXT: srai a0, a0, 24
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 %idx %r = extractelement <vscale x 64 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i16 @extractelt_nxv1i16_0(<vscale x 1 x i16> %v) { define signext i16 @extractelt_nxv1i16_0(<vscale x 1 x i16> %v) {
; CHECK-LABEL: extractelt_nxv1i16_0: ; CHECK-LABEL: extractelt_nxv1i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 0 %r = extractelement <vscale x 1 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv1i16_imm(<vscale x 1 x i16> %v) { define signext i16 @extractelt_nxv1i16_imm(<vscale x 1 x i16> %v) {
; CHECK-LABEL: extractelt_nxv1i16_imm: ; CHECK-LABEL: extractelt_nxv1i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 2 %r = extractelement <vscale x 1 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv1i16_idx(<vscale x 1 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv1i16_idx(<vscale x 1 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv1i16_idx: ; CHECK-LABEL: extractelt_nxv1i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 %idx %r = extractelement <vscale x 1 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_0(<vscale x 2 x i16> %v) { define signext i16 @extractelt_nxv2i16_0(<vscale x 2 x i16> %v) {
; CHECK-LABEL: extractelt_nxv2i16_0: ; CHECK-LABEL: extractelt_nxv2i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 0 %r = extractelement <vscale x 2 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_imm(<vscale x 2 x i16> %v) { define signext i16 @extractelt_nxv2i16_imm(<vscale x 2 x i16> %v) {
; CHECK-LABEL: extractelt_nxv2i16_imm: ; CHECK-LABEL: extractelt_nxv2i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 2 %r = extractelement <vscale x 2 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_idx(<vscale x 2 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv2i16_idx(<vscale x 2 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv2i16_idx: ; CHECK-LABEL: extractelt_nxv2i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 %idx %r = extractelement <vscale x 2 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_0(<vscale x 4 x i16> %v) { define signext i16 @extractelt_nxv4i16_0(<vscale x 4 x i16> %v) {
; CHECK-LABEL: extractelt_nxv4i16_0: ; CHECK-LABEL: extractelt_nxv4i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 0 %r = extractelement <vscale x 4 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_imm(<vscale x 4 x i16> %v) { define signext i16 @extractelt_nxv4i16_imm(<vscale x 4 x i16> %v) {
; CHECK-LABEL: extractelt_nxv4i16_imm: ; CHECK-LABEL: extractelt_nxv4i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 2 %r = extractelement <vscale x 4 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_idx(<vscale x 4 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv4i16_idx(<vscale x 4 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv4i16_idx: ; CHECK-LABEL: extractelt_nxv4i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 %idx %r = extractelement <vscale x 4 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_0(<vscale x 8 x i16> %v) { define signext i16 @extractelt_nxv8i16_0(<vscale x 8 x i16> %v) {
; CHECK-LABEL: extractelt_nxv8i16_0: ; CHECK-LABEL: extractelt_nxv8i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 0 %r = extractelement <vscale x 8 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_imm(<vscale x 8 x i16> %v) { define signext i16 @extractelt_nxv8i16_imm(<vscale x 8 x i16> %v) {
; CHECK-LABEL: extractelt_nxv8i16_imm: ; CHECK-LABEL: extractelt_nxv8i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vslidedown.vi v26, v8, 2
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 2 %r = extractelement <vscale x 8 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_idx(<vscale x 8 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv8i16_idx(<vscale x 8 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv8i16_idx: ; CHECK-LABEL: extractelt_nxv8i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu
; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vslidedown.vx v26, v8, a0
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 %idx %r = extractelement <vscale x 8 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_0(<vscale x 16 x i16> %v) { define signext i16 @extractelt_nxv16i16_0(<vscale x 16 x i16> %v) {
; CHECK-LABEL: extractelt_nxv16i16_0: ; CHECK-LABEL: extractelt_nxv16i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 0 %r = extractelement <vscale x 16 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_imm(<vscale x 16 x i16> %v) { define signext i16 @extractelt_nxv16i16_imm(<vscale x 16 x i16> %v) {
; CHECK-LABEL: extractelt_nxv16i16_imm: ; CHECK-LABEL: extractelt_nxv16i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu
; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vslidedown.vi v28, v8, 2
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 2 %r = extractelement <vscale x 16 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_idx(<vscale x 16 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv16i16_idx(<vscale x 16 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv16i16_idx: ; CHECK-LABEL: extractelt_nxv16i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu
; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vslidedown.vx v28, v8, a0
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 %idx %r = extractelement <vscale x 16 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_0(<vscale x 32 x i16> %v) { define signext i16 @extractelt_nxv32i16_0(<vscale x 32 x i16> %v) {
; CHECK-LABEL: extractelt_nxv32i16_0: ; CHECK-LABEL: extractelt_nxv32i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 0 %r = extractelement <vscale x 32 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_imm(<vscale x 32 x i16> %v) { define signext i16 @extractelt_nxv32i16_imm(<vscale x 32 x i16> %v) {
; CHECK-LABEL: extractelt_nxv32i16_imm: ; CHECK-LABEL: extractelt_nxv32i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu
; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vslidedown.vi v8, v8, 2
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 2 %r = extractelement <vscale x 32 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_idx(<vscale x 32 x i16> %v, i32 %idx) { define signext i16 @extractelt_nxv32i16_idx(<vscale x 32 x i16> %v, i32 %idx) {
; CHECK-LABEL: extractelt_nxv32i16_idx: ; CHECK-LABEL: extractelt_nxv32i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu
; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 16
; CHECK-NEXT: srai a0, a0, 16
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 %idx %r = extractelement <vscale x 32 x i16> %v, i32 %idx
ret i16 %r ret i16 %r

View File

@ -2,577 +2,670 @@
; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \ ; RUN: llc -mtriple=riscv64 -mattr=+d,+experimental-zfh,+experimental-v -target-abi=lp64d \
; RUN: -verify-machineinstrs < %s | FileCheck %s ; RUN: -verify-machineinstrs < %s | FileCheck %s
define i8 @extractelt_nxv1i8_0(<vscale x 1 x i8> %v) { define signext i8 @extractelt_nxv1i8_0(<vscale x 1 x i8> %v) {
; CHECK-LABEL: extractelt_nxv1i8_0: ; CHECK-LABEL: extractelt_nxv1i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 0 %r = extractelement <vscale x 1 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv1i8_imm(<vscale x 1 x i8> %v) { define signext i8 @extractelt_nxv1i8_imm(<vscale x 1 x i8> %v) {
; CHECK-LABEL: extractelt_nxv1i8_imm: ; CHECK-LABEL: extractelt_nxv1i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf8,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 2 %r = extractelement <vscale x 1 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv1i8_idx(<vscale x 1 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv1i8_idx(<vscale x 1 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv1i8_idx: ; CHECK-LABEL: extractelt_nxv1i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf8,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i8> %v, i32 %idx %r = extractelement <vscale x 1 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_0(<vscale x 2 x i8> %v) { define signext i8 @extractelt_nxv2i8_0(<vscale x 2 x i8> %v) {
; CHECK-LABEL: extractelt_nxv2i8_0: ; CHECK-LABEL: extractelt_nxv2i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 0 %r = extractelement <vscale x 2 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_imm(<vscale x 2 x i8> %v) { define signext i8 @extractelt_nxv2i8_imm(<vscale x 2 x i8> %v) {
; CHECK-LABEL: extractelt_nxv2i8_imm: ; CHECK-LABEL: extractelt_nxv2i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf4,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 2 %r = extractelement <vscale x 2 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv2i8_idx(<vscale x 2 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv2i8_idx(<vscale x 2 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv2i8_idx: ; CHECK-LABEL: extractelt_nxv2i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf4,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i8> %v, i32 %idx %r = extractelement <vscale x 2 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_0(<vscale x 4 x i8> %v) { define signext i8 @extractelt_nxv4i8_0(<vscale x 4 x i8> %v) {
; CHECK-LABEL: extractelt_nxv4i8_0: ; CHECK-LABEL: extractelt_nxv4i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,mf2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 0 %r = extractelement <vscale x 4 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_imm(<vscale x 4 x i8> %v) { define signext i8 @extractelt_nxv4i8_imm(<vscale x 4 x i8> %v) {
; CHECK-LABEL: extractelt_nxv4i8_imm: ; CHECK-LABEL: extractelt_nxv4i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,mf2,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 2 %r = extractelement <vscale x 4 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv4i8_idx(<vscale x 4 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv4i8_idx(<vscale x 4 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv4i8_idx: ; CHECK-LABEL: extractelt_nxv4i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,mf2,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i8> %v, i32 %idx %r = extractelement <vscale x 4 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_0(<vscale x 8 x i8> %v) { define signext i8 @extractelt_nxv8i8_0(<vscale x 8 x i8> %v) {
; CHECK-LABEL: extractelt_nxv8i8_0: ; CHECK-LABEL: extractelt_nxv8i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m1,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 0 %r = extractelement <vscale x 8 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_imm(<vscale x 8 x i8> %v) { define signext i8 @extractelt_nxv8i8_imm(<vscale x 8 x i8> %v) {
; CHECK-LABEL: extractelt_nxv8i8_imm: ; CHECK-LABEL: extractelt_nxv8i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m1,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 2 %r = extractelement <vscale x 8 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv8i8_idx(<vscale x 8 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv8i8_idx(<vscale x 8 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv8i8_idx: ; CHECK-LABEL: extractelt_nxv8i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m1,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i8> %v, i32 %idx %r = extractelement <vscale x 8 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_0(<vscale x 16 x i8> %v) { define signext i8 @extractelt_nxv16i8_0(<vscale x 16 x i8> %v) {
; CHECK-LABEL: extractelt_nxv16i8_0: ; CHECK-LABEL: extractelt_nxv16i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 0 %r = extractelement <vscale x 16 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_imm(<vscale x 16 x i8> %v) { define signext i8 @extractelt_nxv16i8_imm(<vscale x 16 x i8> %v) {
; CHECK-LABEL: extractelt_nxv16i8_imm: ; CHECK-LABEL: extractelt_nxv16i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m2,ta,mu
; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vslidedown.vi v26, v8, 2
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 2 %r = extractelement <vscale x 16 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv16i8_idx(<vscale x 16 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv16i8_idx(<vscale x 16 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv16i8_idx: ; CHECK-LABEL: extractelt_nxv16i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m2,ta,mu
; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vslidedown.vx v26, v8, a0
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i8> %v, i32 %idx %r = extractelement <vscale x 16 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_0(<vscale x 32 x i8> %v) { define signext i8 @extractelt_nxv32i8_0(<vscale x 32 x i8> %v) {
; CHECK-LABEL: extractelt_nxv32i8_0: ; CHECK-LABEL: extractelt_nxv32i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 0 %r = extractelement <vscale x 32 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_imm(<vscale x 32 x i8> %v) { define signext i8 @extractelt_nxv32i8_imm(<vscale x 32 x i8> %v) {
; CHECK-LABEL: extractelt_nxv32i8_imm: ; CHECK-LABEL: extractelt_nxv32i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m4,ta,mu
; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vslidedown.vi v28, v8, 2
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 2 %r = extractelement <vscale x 32 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv32i8_idx(<vscale x 32 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv32i8_idx(<vscale x 32 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv32i8_idx: ; CHECK-LABEL: extractelt_nxv32i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m4,ta,mu
; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vslidedown.vx v28, v8, a0
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i8> %v, i32 %idx %r = extractelement <vscale x 32 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_0(<vscale x 64 x i8> %v) { define signext i8 @extractelt_nxv64i8_0(<vscale x 64 x i8> %v) {
; CHECK-LABEL: extractelt_nxv64i8_0: ; CHECK-LABEL: extractelt_nxv64i8_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e8,m8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 0 %r = extractelement <vscale x 64 x i8> %v, i32 0
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_imm(<vscale x 64 x i8> %v) { define signext i8 @extractelt_nxv64i8_imm(<vscale x 64 x i8> %v) {
; CHECK-LABEL: extractelt_nxv64i8_imm: ; CHECK-LABEL: extractelt_nxv64i8_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e8,m8,ta,mu
; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vslidedown.vi v8, v8, 2
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 2 %r = extractelement <vscale x 64 x i8> %v, i32 2
ret i8 %r ret i8 %r
} }
define i8 @extractelt_nxv64i8_idx(<vscale x 64 x i8> %v, i32 signext %idx) { define signext i8 @extractelt_nxv64i8_idx(<vscale x 64 x i8> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv64i8_idx: ; CHECK-LABEL: extractelt_nxv64i8_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e8,m8,ta,mu
; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 56
; CHECK-NEXT: srai a0, a0, 56
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 64 x i8> %v, i32 %idx %r = extractelement <vscale x 64 x i8> %v, i32 %idx
ret i8 %r ret i8 %r
} }
define i16 @extractelt_nxv1i16_0(<vscale x 1 x i16> %v) { define signext i16 @extractelt_nxv1i16_0(<vscale x 1 x i16> %v) {
; CHECK-LABEL: extractelt_nxv1i16_0: ; CHECK-LABEL: extractelt_nxv1i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,mf4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 0 %r = extractelement <vscale x 1 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv1i16_imm(<vscale x 1 x i16> %v) { define signext i16 @extractelt_nxv1i16_imm(<vscale x 1 x i16> %v) {
; CHECK-LABEL: extractelt_nxv1i16_imm: ; CHECK-LABEL: extractelt_nxv1i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,mf4,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 2 %r = extractelement <vscale x 1 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv1i16_idx(<vscale x 1 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv1i16_idx(<vscale x 1 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv1i16_idx: ; CHECK-LABEL: extractelt_nxv1i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,mf4,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i16> %v, i32 %idx %r = extractelement <vscale x 1 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_0(<vscale x 2 x i16> %v) { define signext i16 @extractelt_nxv2i16_0(<vscale x 2 x i16> %v) {
; CHECK-LABEL: extractelt_nxv2i16_0: ; CHECK-LABEL: extractelt_nxv2i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,mf2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 0 %r = extractelement <vscale x 2 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_imm(<vscale x 2 x i16> %v) { define signext i16 @extractelt_nxv2i16_imm(<vscale x 2 x i16> %v) {
; CHECK-LABEL: extractelt_nxv2i16_imm: ; CHECK-LABEL: extractelt_nxv2i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,mf2,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 2 %r = extractelement <vscale x 2 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv2i16_idx(<vscale x 2 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv2i16_idx(<vscale x 2 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv2i16_idx: ; CHECK-LABEL: extractelt_nxv2i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,mf2,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i16> %v, i32 %idx %r = extractelement <vscale x 2 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_0(<vscale x 4 x i16> %v) { define signext i16 @extractelt_nxv4i16_0(<vscale x 4 x i16> %v) {
; CHECK-LABEL: extractelt_nxv4i16_0: ; CHECK-LABEL: extractelt_nxv4i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m1,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 0 %r = extractelement <vscale x 4 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_imm(<vscale x 4 x i16> %v) { define signext i16 @extractelt_nxv4i16_imm(<vscale x 4 x i16> %v) {
; CHECK-LABEL: extractelt_nxv4i16_imm: ; CHECK-LABEL: extractelt_nxv4i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m1,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 2 %r = extractelement <vscale x 4 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv4i16_idx(<vscale x 4 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv4i16_idx(<vscale x 4 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv4i16_idx: ; CHECK-LABEL: extractelt_nxv4i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m1,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i16> %v, i32 %idx %r = extractelement <vscale x 4 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_0(<vscale x 8 x i16> %v) { define signext i16 @extractelt_nxv8i16_0(<vscale x 8 x i16> %v) {
; CHECK-LABEL: extractelt_nxv8i16_0: ; CHECK-LABEL: extractelt_nxv8i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 0 %r = extractelement <vscale x 8 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_imm(<vscale x 8 x i16> %v) { define signext i16 @extractelt_nxv8i16_imm(<vscale x 8 x i16> %v) {
; CHECK-LABEL: extractelt_nxv8i16_imm: ; CHECK-LABEL: extractelt_nxv8i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m2,ta,mu
; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vslidedown.vi v26, v8, 2
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 2 %r = extractelement <vscale x 8 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv8i16_idx(<vscale x 8 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv8i16_idx(<vscale x 8 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv8i16_idx: ; CHECK-LABEL: extractelt_nxv8i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m2,ta,mu
; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vslidedown.vx v26, v8, a0
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i16> %v, i32 %idx %r = extractelement <vscale x 8 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_0(<vscale x 16 x i16> %v) { define signext i16 @extractelt_nxv16i16_0(<vscale x 16 x i16> %v) {
; CHECK-LABEL: extractelt_nxv16i16_0: ; CHECK-LABEL: extractelt_nxv16i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 0 %r = extractelement <vscale x 16 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_imm(<vscale x 16 x i16> %v) { define signext i16 @extractelt_nxv16i16_imm(<vscale x 16 x i16> %v) {
; CHECK-LABEL: extractelt_nxv16i16_imm: ; CHECK-LABEL: extractelt_nxv16i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m4,ta,mu
; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vslidedown.vi v28, v8, 2
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 2 %r = extractelement <vscale x 16 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv16i16_idx(<vscale x 16 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv16i16_idx(<vscale x 16 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv16i16_idx: ; CHECK-LABEL: extractelt_nxv16i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m4,ta,mu
; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vslidedown.vx v28, v8, a0
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i16> %v, i32 %idx %r = extractelement <vscale x 16 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_0(<vscale x 32 x i16> %v) { define signext i16 @extractelt_nxv32i16_0(<vscale x 32 x i16> %v) {
; CHECK-LABEL: extractelt_nxv32i16_0: ; CHECK-LABEL: extractelt_nxv32i16_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e16,m8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 0 %r = extractelement <vscale x 32 x i16> %v, i32 0
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_imm(<vscale x 32 x i16> %v) { define signext i16 @extractelt_nxv32i16_imm(<vscale x 32 x i16> %v) {
; CHECK-LABEL: extractelt_nxv32i16_imm: ; CHECK-LABEL: extractelt_nxv32i16_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e16,m8,ta,mu
; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vslidedown.vi v8, v8, 2
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 2 %r = extractelement <vscale x 32 x i16> %v, i32 2
ret i16 %r ret i16 %r
} }
define i16 @extractelt_nxv32i16_idx(<vscale x 32 x i16> %v, i32 signext %idx) { define signext i16 @extractelt_nxv32i16_idx(<vscale x 32 x i16> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv32i16_idx: ; CHECK-LABEL: extractelt_nxv32i16_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e16,m8,ta,mu
; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: slli a0, a0, 48
; CHECK-NEXT: srai a0, a0, 48
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 32 x i16> %v, i32 %idx %r = extractelement <vscale x 32 x i16> %v, i32 %idx
ret i16 %r ret i16 %r
} }
define i32 @extractelt_nxv1i32_0(<vscale x 1 x i32> %v) { define signext i32 @extractelt_nxv1i32_0(<vscale x 1 x i32> %v) {
; CHECK-LABEL: extractelt_nxv1i32_0: ; CHECK-LABEL: extractelt_nxv1i32_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e32,mf2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e32,mf2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i32> %v, i32 0 %r = extractelement <vscale x 1 x i32> %v, i32 0
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv1i32_imm(<vscale x 1 x i32> %v) { define signext i32 @extractelt_nxv1i32_imm(<vscale x 1 x i32> %v) {
; CHECK-LABEL: extractelt_nxv1i32_imm: ; CHECK-LABEL: extractelt_nxv1i32_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e32,mf2,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i32> %v, i32 2 %r = extractelement <vscale x 1 x i32> %v, i32 2
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv1i32_idx(<vscale x 1 x i32> %v, i32 signext %idx) { define signext i32 @extractelt_nxv1i32_idx(<vscale x 1 x i32> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv1i32_idx: ; CHECK-LABEL: extractelt_nxv1i32_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e32,mf2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e32,mf2,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 1 x i32> %v, i32 %idx %r = extractelement <vscale x 1 x i32> %v, i32 %idx
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv2i32_0(<vscale x 2 x i32> %v) { define signext i32 @extractelt_nxv2i32_0(<vscale x 2 x i32> %v) {
; CHECK-LABEL: extractelt_nxv2i32_0: ; CHECK-LABEL: extractelt_nxv2i32_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e32,m1,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e32,m1,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i32> %v, i32 0 %r = extractelement <vscale x 2 x i32> %v, i32 0
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv2i32_imm(<vscale x 2 x i32> %v) { define signext i32 @extractelt_nxv2i32_imm(<vscale x 2 x i32> %v) {
; CHECK-LABEL: extractelt_nxv2i32_imm: ; CHECK-LABEL: extractelt_nxv2i32_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e32,m1,ta,mu
; CHECK-NEXT: vslidedown.vi v25, v8, 2 ; CHECK-NEXT: vslidedown.vi v25, v8, 2
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i32> %v, i32 2 %r = extractelement <vscale x 2 x i32> %v, i32 2
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv2i32_idx(<vscale x 2 x i32> %v, i32 signext %idx) { define signext i32 @extractelt_nxv2i32_idx(<vscale x 2 x i32> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv2i32_idx: ; CHECK-LABEL: extractelt_nxv2i32_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e32,m1,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e32,m1,ta,mu
; CHECK-NEXT: vslidedown.vx v25, v8, a0 ; CHECK-NEXT: vslidedown.vx v25, v8, a0
; CHECK-NEXT: vmv.x.s a0, v25 ; CHECK-NEXT: vmv.x.s a0, v25
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 2 x i32> %v, i32 %idx %r = extractelement <vscale x 2 x i32> %v, i32 %idx
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv4i32_0(<vscale x 4 x i32> %v) { define signext i32 @extractelt_nxv4i32_0(<vscale x 4 x i32> %v) {
; CHECK-LABEL: extractelt_nxv4i32_0: ; CHECK-LABEL: extractelt_nxv4i32_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e32,m2,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e32,m2,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i32> %v, i32 0 %r = extractelement <vscale x 4 x i32> %v, i32 0
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv4i32_imm(<vscale x 4 x i32> %v) { define signext i32 @extractelt_nxv4i32_imm(<vscale x 4 x i32> %v) {
; CHECK-LABEL: extractelt_nxv4i32_imm: ; CHECK-LABEL: extractelt_nxv4i32_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e32,m2,ta,mu
; CHECK-NEXT: vslidedown.vi v26, v8, 2 ; CHECK-NEXT: vslidedown.vi v26, v8, 2
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i32> %v, i32 2 %r = extractelement <vscale x 4 x i32> %v, i32 2
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv4i32_idx(<vscale x 4 x i32> %v, i32 signext %idx) { define signext i32 @extractelt_nxv4i32_idx(<vscale x 4 x i32> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv4i32_idx: ; CHECK-LABEL: extractelt_nxv4i32_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e32,m2,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e32,m2,ta,mu
; CHECK-NEXT: vslidedown.vx v26, v8, a0 ; CHECK-NEXT: vslidedown.vx v26, v8, a0
; CHECK-NEXT: vmv.x.s a0, v26 ; CHECK-NEXT: vmv.x.s a0, v26
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 4 x i32> %v, i32 %idx %r = extractelement <vscale x 4 x i32> %v, i32 %idx
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv8i32_0(<vscale x 8 x i32> %v) { define signext i32 @extractelt_nxv8i32_0(<vscale x 8 x i32> %v) {
; CHECK-LABEL: extractelt_nxv8i32_0: ; CHECK-LABEL: extractelt_nxv8i32_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e32,m4,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e32,m4,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i32> %v, i32 0 %r = extractelement <vscale x 8 x i32> %v, i32 0
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv8i32_imm(<vscale x 8 x i32> %v) { define signext i32 @extractelt_nxv8i32_imm(<vscale x 8 x i32> %v) {
; CHECK-LABEL: extractelt_nxv8i32_imm: ; CHECK-LABEL: extractelt_nxv8i32_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e32,m4,ta,mu
; CHECK-NEXT: vslidedown.vi v28, v8, 2 ; CHECK-NEXT: vslidedown.vi v28, v8, 2
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i32> %v, i32 2 %r = extractelement <vscale x 8 x i32> %v, i32 2
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv8i32_idx(<vscale x 8 x i32> %v, i32 signext %idx) { define signext i32 @extractelt_nxv8i32_idx(<vscale x 8 x i32> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv8i32_idx: ; CHECK-LABEL: extractelt_nxv8i32_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e32,m4,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e32,m4,ta,mu
; CHECK-NEXT: vslidedown.vx v28, v8, a0 ; CHECK-NEXT: vslidedown.vx v28, v8, a0
; CHECK-NEXT: vmv.x.s a0, v28 ; CHECK-NEXT: vmv.x.s a0, v28
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 8 x i32> %v, i32 %idx %r = extractelement <vscale x 8 x i32> %v, i32 %idx
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv16i32_0(<vscale x 16 x i32> %v) { define signext i32 @extractelt_nxv16i32_0(<vscale x 16 x i32> %v) {
; CHECK-LABEL: extractelt_nxv16i32_0: ; CHECK-LABEL: extractelt_nxv16i32_0:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli zero, zero, e32,m8,ta,mu ; CHECK-NEXT: vsetvli zero, zero, e32,m8,ta,mu
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i32> %v, i32 0 %r = extractelement <vscale x 16 x i32> %v, i32 0
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv16i32_imm(<vscale x 16 x i32> %v) { define signext i32 @extractelt_nxv16i32_imm(<vscale x 16 x i32> %v) {
; CHECK-LABEL: extractelt_nxv16i32_imm: ; CHECK-LABEL: extractelt_nxv16i32_imm:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu ; CHECK-NEXT: vsetvli a0, zero, e32,m8,ta,mu
; CHECK-NEXT: vslidedown.vi v8, v8, 2 ; CHECK-NEXT: vslidedown.vi v8, v8, 2
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i32> %v, i32 2 %r = extractelement <vscale x 16 x i32> %v, i32 2
ret i32 %r ret i32 %r
} }
define i32 @extractelt_nxv16i32_idx(<vscale x 16 x i32> %v, i32 signext %idx) { define signext i32 @extractelt_nxv16i32_idx(<vscale x 16 x i32> %v, i32 signext %idx) {
; CHECK-LABEL: extractelt_nxv16i32_idx: ; CHECK-LABEL: extractelt_nxv16i32_idx:
; CHECK: # %bb.0: ; CHECK: # %bb.0:
; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu ; CHECK-NEXT: vsetvli a1, zero, e32,m8,ta,mu
; CHECK-NEXT: vslidedown.vx v8, v8, a0 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
; CHECK-NEXT: vmv.x.s a0, v8 ; CHECK-NEXT: vmv.x.s a0, v8
; CHECK-NEXT: sext.w a0, a0
; CHECK-NEXT: ret ; CHECK-NEXT: ret
%r = extractelement <vscale x 16 x i32> %v, i32 %idx %r = extractelement <vscale x 16 x i32> %v, i32 %idx
ret i32 %r ret i32 %r