1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc -O3 -march=mipsel -mcpu=mips32r6 -mattr=+fp64,+msa %s -o - | FileCheck %s 3 4; Test that checks if spill for ldi can be avoided and instruction will be 5; rematerialized. 6 7declare dso_local void @foo() 8 9define dso_local void @test_ldi_b() { 10; CHECK-LABEL: test_ldi_b: 11; CHECK: # %bb.0: # %entry 12; CHECK-NEXT: addiu $sp, $sp, -24 13; CHECK-NEXT: .cfi_def_cfa_offset 24 14; CHECK-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 15; CHECK-NEXT: .cfi_offset 31, -4 16; CHECK-NEXT: ldi.b $w0, 1 17; CHECK-NEXT: #APP 18; CHECK-NEXT: #NO_APP 19; CHECK-NEXT: jal foo 20; CHECK-NEXT: nop 21; CHECK-NEXT: ldi.b $w0, 1 22; CHECK-NEXT: #APP 23; CHECK-NEXT: #NO_APP 24; CHECK-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 25; CHECK-NEXT: jr $ra 26; CHECK-NEXT: addiu $sp, $sp, 24 27entry: 28 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>) 29 tail call void @foo() 30 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<16 x i8> <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>) 31 ret void 32} 33 34define dso_local void @test_ldi_h() { 35; CHECK-LABEL: test_ldi_h: 36; CHECK: # %bb.0: # %entry 37; CHECK-NEXT: addiu $sp, $sp, -24 38; CHECK-NEXT: .cfi_def_cfa_offset 24 39; CHECK-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 40; CHECK-NEXT: .cfi_offset 31, -4 41; CHECK-NEXT: ldi.h $w0, 2 42; CHECK-NEXT: #APP 43; CHECK-NEXT: #NO_APP 44; CHECK-NEXT: jal foo 45; CHECK-NEXT: nop 46; CHECK-NEXT: ldi.h $w0, 2 47; CHECK-NEXT: #APP 48; CHECK-NEXT: #NO_APP 49; CHECK-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 50; CHECK-NEXT: jr $ra 51; CHECK-NEXT: addiu $sp, $sp, 24 52entry: 53 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<8 x i16> <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>) 54 tail call void @foo() 55 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<8 x i16> <i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2, i16 2>) 56 ret void 57} 58 59define dso_local void @test_ldi_w() { 60; CHECK-LABEL: test_ldi_w: 61; CHECK: # %bb.0: # %entry 62; CHECK-NEXT: addiu $sp, $sp, -24 63; CHECK-NEXT: .cfi_def_cfa_offset 24 64; CHECK-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 65; CHECK-NEXT: .cfi_offset 31, -4 66; CHECK-NEXT: ldi.w $w0, 3 67; CHECK-NEXT: #APP 68; CHECK-NEXT: #NO_APP 69; CHECK-NEXT: jal foo 70; CHECK-NEXT: nop 71; CHECK-NEXT: ldi.w $w0, 3 72; CHECK-NEXT: #APP 73; CHECK-NEXT: #NO_APP 74; CHECK-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 75; CHECK-NEXT: jr $ra 76; CHECK-NEXT: addiu $sp, $sp, 24 77entry: 78 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<4 x i32> <i32 3, i32 3, i32 3, i32 3>) 79 tail call void @foo() 80 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<4 x i32> <i32 3, i32 3, i32 3, i32 3>) 81 ret void 82} 83 84define dso_local void @test_ldi_d() { 85; CHECK-LABEL: test_ldi_d: 86; CHECK: # %bb.0: # %entry 87; CHECK-NEXT: addiu $sp, $sp, -24 88; CHECK-NEXT: .cfi_def_cfa_offset 24 89; CHECK-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill 90; CHECK-NEXT: .cfi_offset 31, -4 91; CHECK-NEXT: ldi.d $w0, 4 92; CHECK-NEXT: #APP 93; CHECK-NEXT: #NO_APP 94; CHECK-NEXT: jal foo 95; CHECK-NEXT: nop 96; CHECK-NEXT: ldi.d $w0, 4 97; CHECK-NEXT: #APP 98; CHECK-NEXT: #NO_APP 99; CHECK-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload 100; CHECK-NEXT: jr $ra 101; CHECK-NEXT: addiu $sp, $sp, 24 102entry: 103 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<2 x i64> <i64 4, i64 4>) 104 tail call void @foo() 105 tail call void asm sideeffect "", "f,~{memory},~{$1}"(<2 x i64> <i64 4, i64 4>) 106 ret void 107} 108