blob: 6b077986587523e6d12fabcab65afc80f7d37bb5 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=mipsel -mcpu=mips32r2 -mattr=+dspr2 -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -mtriple=mips -mcpu=mips32r2 -mattr=+dspr2 -verify-machineinstrs < %s | FileCheck %s
; RUN: llc -mtriple=mipsel -mcpu=mips32r2 -mattr=+dsp -verify-machineinstrs < %s | FileCheck %s
; v2i16 and v4i8 both live in DSPR, so a bitcast between them is a no-op.
; The patterns only require HasDSP, hence the +dsp run.
; These used to fail to select: https://github.com/llvm/llvm-project/issues/245155
define i8 @bitcast_v2i16_to_v4i8(<2 x i16> %a) {
; CHECK-LABEL: bitcast_v2i16_to_v4i8:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addiu $sp, $sp, -8
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: sw $4, 4($sp)
; CHECK-NEXT: lbu $2, 4($sp)
; CHECK-NEXT: jr $ra
; CHECK-NEXT: addiu $sp, $sp, 8
entry:
br label %bb1
bb1:
%b = bitcast <2 x i16> %a to <4 x i8>
br label %bb2
bb2:
%e = extractelement <4 x i8> %b, i64 0
ret i8 %e
}
define i16 @bitcast_v4i8_to_v2i16(<4 x i8> %a) {
; CHECK-LABEL: bitcast_v4i8_to_v2i16:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: addiu $sp, $sp, -8
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: sw $4, 4($sp)
; CHECK-NEXT: lhu $2, 4($sp)
; CHECK-NEXT: jr $ra
; CHECK-NEXT: addiu $sp, $sp, 8
entry:
br label %bb1
bb1:
%b = bitcast <4 x i8> %a to <2 x i16>
br label %bb2
bb2:
%e = extractelement <2 x i16> %b, i64 0
ret i16 %e
}