1 ; RUN: llc -march=mipsel -mcpu=mips32r5 -mattr=+fp64,+msa,-nooddspreg \
2 ; RUN: -verify-machineinstrs -no-integrated-as -relocation-model=pic < %s | \
3 ; RUN: FileCheck %s -check-prefixes=ALL,ODDSPREG
4 ; RUN: llc -march=mipsel -mcpu=mips32r5 -mattr=+fp64,+msa,+nooddspreg \
5 ; RUN: -verify-machineinstrs -no-integrated-as -relocation-model=pic < %s | \
6 ; RUN: FileCheck %s -check-prefixes=ALL,NOODDSPREG
8 @v4f32 = global <4 x float> zeroinitializer
10 define void @msa_insert_0(float %a) {
12 ; Force the float into an odd-numbered register using named registers and
14 %b = call float asm sideeffect "mov.s $0, $1", "={$f13},{$f12}" (float %a)
15 %0 = load volatile <4 x float>, ptr @v4f32
17 ; Clobber all except $f12/$w12 and $f13
19 ; The intention is that if odd single precision registers are permitted, the
20 ; allocator will choose $f12/$w12 for the vector and $f13 for the float to
21 ; avoid the spill/reload.
23 ; On the other hand, if odd single precision registers are not permitted, it
24 ; must copy $f13 to an even-numbered register before inserting into the
26 call void asm sideeffect "teqi $$zero, 1", "~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31}"()
27 %1 = insertelement <4 x float> %0, float %b, i32 0
28 store <4 x float> %1, ptr @v4f32
32 ; ALL-LABEL: msa_insert_0:
33 ; ALL: mov.s $f13, $f12
34 ; NOODDSPREG: mov.s $f[[F0:[0-9]+]], $f13
35 ; ALL: lw $[[R0:[0-9]+]], %got(v4f32)(
36 ; ALL: ld.w $w[[W0:[0-9]+]], 0($[[R0]])
37 ; NOODDSPREG: insve.w $w[[W0]][0], $w[[F0]][0]
38 ; ODDSPREG: insve.w $w[[W0]][0], $w13[0]
42 ; ALL: st.w $w[[W0]], 0($[[R0]])
44 define void @msa_insert_1(float %a) {
46 ; Force the float into an odd-numbered register using named registers and
48 %b = call float asm sideeffect "mov.s $0, $1", "={$f13},{$f12}" (float %a)
49 %0 = load volatile <4 x float>, ptr @v4f32
51 ; Clobber all except $f12/$w12 and $f13
53 ; The intention is that if odd single precision registers are permitted, the
54 ; allocator will choose $f12/$w12 for the vector and $f13 for the float to
55 ; avoid the spill/reload.
57 ; On the other hand, if odd single precision registers are not permitted, it
58 ; must copy $f13 to an even-numbered register before inserting into the
60 call void asm sideeffect "teqi $$zero, 1", "~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31}"()
61 %1 = insertelement <4 x float> %0, float %b, i32 1
62 store <4 x float> %1, ptr @v4f32
66 ; ALL-LABEL: msa_insert_1:
67 ; ALL: mov.s $f13, $f12
68 ; NOODDSPREG: mov.s $f[[F0:[0-9]+]], $f13
69 ; ALL: lw $[[R0:[0-9]+]], %got(v4f32)(
70 ; ALL: ld.w $w[[W0:[0-9]+]], 0($[[R0]])
71 ; NOODDSPREG: insve.w $w[[W0]][1], $w[[F0]][0]
72 ; ODDSPREG: insve.w $w[[W0]][1], $w13[0]
76 ; ALL: st.w $w[[W0]], 0($[[R0]])
78 define float @msa_extract_0() {
80 %0 = load volatile <4 x float>, ptr @v4f32
81 %1 = call <4 x float> asm sideeffect "move.v $0, $1", "={$w13},{$w12}" (<4 x float> %0)
83 ; Clobber all except $f12, and $f13
85 ; The intention is that if odd single precision registers are permitted, the
86 ; allocator will choose $f13/$w13 for the vector since that saves on moves.
88 ; On the other hand, if odd single precision registers are not permitted, it
89 ; must move it to $f12/$w12.
90 call void asm sideeffect "teqi $$zero, 1", "~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31}"()
92 %2 = extractelement <4 x float> %1, i32 0
96 ; ALL-LABEL: msa_extract_0:
97 ; ALL: lw $[[R0:[0-9]+]], %got(v4f32)(
98 ; ALL: ld.w $w12, 0($[[R0]])
99 ; ALL: move.v $w[[W0:13]], $w12
100 ; NOODDSPREG: move.v $w[[W0:12]], $w13
104 ; ALL: mov.s $f0, $f[[W0]]
106 define float @msa_extract_1() {
108 %0 = load volatile <4 x float>, ptr @v4f32
109 %1 = call <4 x float> asm sideeffect "move.v $0, $1", "={$w13},{$w12}" (<4 x float> %0)
111 ; Clobber all except $f13
113 ; The intention is that if odd single precision registers are permitted, the
114 ; allocator will choose $f13/$w13 for the vector since that saves on moves.
116 ; On the other hand, if odd single precision registers are not permitted, it
118 call void asm sideeffect "teqi $$zero, 1", "~{$f0},~{$f1},~{$f2},~{$f3},~{$f4},~{$f5},~{$f6},~{$f7},~{$f8},~{$f9},~{$f10},~{$f11},~{$f12},~{$f14},~{$f15},~{$f16},~{$f17},~{$f18},~{$f19},~{$f20},~{$f21},~{$f22},~{$f23},~{$f24},~{$f25},~{$f26},~{$f27},~{$f28},~{$f29},~{$f30},~{$f31}"()
120 %2 = extractelement <4 x float> %1, i32 1
124 ; ALL-LABEL: msa_extract_1:
125 ; ALL: lw $[[R0:[0-9]+]], %got(v4f32)(
126 ; ALL: ld.w $w12, 0($[[R0]])
127 ; ALL: splati.w $w[[W0:[0-9]+]], $w13[1]
128 ; NOODDSPREG: st.w $w[[W0]], 0($sp)
134 ; NOODDSPREG: ld.w $w0, 0($sp)
135 ; ODDSPREG: mov.s $f0, $f[[W0]]