blob: 871a45017158269de0ffb7446872fd871b02ad3e [file] [log] [blame]
Simon Dardis055192c2017-10-03 13:45:49 +00001; RUN: llc -march=mips -mattr=+dsp < %s -asm-show-inst -O0 | FileCheck %s \
2; RUN: --check-prefixes=ASM,ALL
3; RUN: llc -march=mips -mattr=+dsp,+micromips < %s -O0 -filetype=obj | \
4; RUN: llvm-objdump -d - | FileCheck %s --check-prefixes=MM-OBJ,ALL
5
6; Test that spill and reloads use the dsp "variant" instructions. We use -O0
7; to use the simple register allocator.
8
9; To test the micromips output, we have to take a round trip through the
10; object file encoder/decoder as the instruction mapping tables are used to
11; support micromips.
12
13; FIXME: We should be able to get rid of those instructions with the variable
14; value registers.
15
16; ALL-LABEL: spill_reload:
17
18define <4 x i8> @spill_reload(<4 x i8> %a, <4 x i8> %b, i32 %g) {
19entry:
20 %c = tail call <4 x i8> @llvm.mips.addu.qb(<4 x i8> %a, <4 x i8> %b)
21 %cond = icmp eq i32 %g, 0
22 br i1 %cond, label %true, label %end
23
24; ASM: SWDSP
25; ASM: SWDSP
26; ASM: SWDSP
27
28; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
29; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
30; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
31; MM-OBJ: sw ${{[0-9]+}}, {{[0-9]+}}($sp)
32
33true:
34 ret <4 x i8> %c
35
36; ASM: LWDSP
37
38; MM-OBJ: lw ${{[0-9]+}}, {{[0-9]+}}($sp)
39
40end:
41 %d = tail call <4 x i8> @llvm.mips.addu.qb(<4 x i8> %c, <4 x i8> %a)
42 ret <4 x i8> %d
43
44; ASM: LWDSP
45; ASM: LWDSP
46
47; MM-OBJ: lw ${{[0-9]+}}, {{[0-9]+}}($sp)
48; MM-OBJ: lw ${{[0-9]+}}, {{[0-9]+}}($sp)
49
50}
51
52declare <4 x i8> @llvm.mips.addu.qb(<4 x i8>, <4 x i8>) nounwind