1 ; RUN: llc -mtriple=mipsel -relocation-model=pic -O0 \
2 ; RUN: -fast-isel-abort=3 -mcpu=mips32r2 < %s | FileCheck %s
3 ; RUN: llc -mtriple=mipsel -relocation-model=pic -O0 \
4 ; RUN: -fast-isel-abort=3 -mcpu=mips32 < %s | FileCheck %s
6 @s1 = global i16 -89, align 2
7 @s2 = global i16 4, align 2
8 @us1 = global i16 -503, align 2
9 @us2 = global i16 5, align 2
10 @s3 = common global i16 0, align 2
11 @us3 = common global i16 0, align 2
15 %0 = load i16, ptr @s1, align 2
16 %1 = load i16, ptr @s2, align 2
18 store i16 %shl, ptr @s3, align 2
20 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
21 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
22 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
23 ; CHECK-DAG: lw $[[S3_ADDR:[0-9]+]], %got(s3)($[[REG_GP]])
24 ; CHECK-DAG: lw $[[S2_ADDR:[0-9]+]], %got(s2)($[[REG_GP]])
25 ; CHECK-DAG: lw $[[S1_ADDR:[0-9]+]], %got(s1)($[[REG_GP]])
26 ; CHECK-DAG: lhu $[[S1:[0-9]+]], 0($[[S1_ADDR]])
27 ; CHECK-DAG: lhu $[[S2:[0-9]+]], 0($[[S2_ADDR]])
28 ; CHECK-DAG: sllv $[[RES:[0-9]+]], $[[S1]], $[[S2]]
29 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])
35 %0 = load i16, ptr @s1, align 2
37 store i16 %shl, ptr @s3, align 2
39 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
40 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
41 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
42 ; CHECK-DAG: lw $[[S1_ADDR:[0-9]+]], %got(s1)($[[REG_GP]])
43 ; CHECK-DAG: lhu $[[S1:[0-9]+]], 0($[[S1_ADDR]])
44 ; CHECK: sll $[[RES:[0-9]+]], $[[S1]], 5
45 ; CHECK: lw $[[S3_ADDR:[0-9]+]], %got(s3)($[[REG_GP]])
46 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])
52 %0 = load i16, ptr @us1, align 2
53 %1 = load i16, ptr @us2, align 2
54 %shr = lshr i16 %0, %1
55 store i16 %shr, ptr @us3, align 2
58 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
59 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
60 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
61 ; CHECK-DAG: lw $[[US2_ADDR:[0-9]+]], %got(us2)($[[REG_GP]])
62 ; CHECK-DAG: lw $[[US1_ADDR:[0-9]+]], %got(us1)($[[REG_GP]])
63 ; CHECK-DAG: lhu $[[US1:[0-9]+]], 0($[[US1_ADDR]])
64 ; CHECK-DAG: lhu $[[US2:[0-9]+]], 0($[[US2_ADDR]])
65 ; CHECK: srlv $[[RES:[0-9]+]], $[[US1]], $[[US2]]
66 ; CHECK: lw $[[US3_ADDR:[0-9]+]], %got(us3)($[[REG_GP]])
67 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])
72 %0 = load i16, ptr @us1, align 2
74 store i16 %shr, ptr @us3, align 2
76 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
77 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
78 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
79 ; CHECK-DAG: lw $[[US1_ADDR:[0-9]+]], %got(us1)($[[REG_GP]])
80 ; CHECK-DAG: lhu $[[US1:[0-9]+]], 0($[[US1_ADDR]])
81 ; CHECK: srl $[[RES:[0-9]+]], $[[US1]], 4
82 ; CHECK: lw $[[US3_ADDR:[0-9]+]], %got(us3)($[[REG_GP]])
83 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])
89 %0 = load i16, ptr @s1, align 2
90 %1 = load i16, ptr @s2, align 2
91 %shr = ashr i16 %0, %1
92 store i16 %shr, ptr @s3, align 2
94 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
95 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
96 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
97 ; CHECK-DAG: lw $[[S2_ADDR:[0-9]+]], %got(s2)($[[REG_GP]])
98 ; CHECK-DAG: lw $[[S1_ADDR:[0-9]+]], %got(s1)($[[REG_GP]])
99 ; CHECK-DAG: lhu $[[S1:[0-9]+]], 0($[[S1_ADDR]])
100 ; CHECK-DAG: lhu $[[S2:[0-9]+]], 0($[[S2_ADDR]])
101 ; CHECK: srav $[[RES:[0-9]+]], $[[S1]], $[[S2]]
102 ; CHECK: lw $[[S3_ADDR:[0-9]+]], %got(s3)($[[REG_GP]])
103 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])
107 define void @srai() {
109 %0 = load i16, ptr @s1, align 2
110 %shr = ashr i16 %0, 2
111 store i16 %shr, ptr @s3, align 2
113 ; CHECK: lui $[[REG_GPa:[0-9]+]], %hi(_gp_disp)
114 ; CHECK-DAG: addiu $[[REG_GPb:[0-9]+]], $[[REG_GPa]], %lo(_gp_disp)
115 ; CHECK-DAG: addu $[[REG_GP:[0-9]+]], $[[REG_GPb]], $25
116 ; CHECK-DAG: lw $[[S1_ADDR:[0-9]+]], %got(s1)($[[REG_GP]])
117 ; CHECK-DAG: lhu $[[S1:[0-9]+]], 0($[[S1_ADDR]])
118 ; CHECK: sra $[[RES:[0-9]+]], $[[S1]], 2
119 ; CHECK: lw $[[S3_ADDR:[0-9]+]], %got(s3)($[[REG_GP]])
120 ; CHECK: sh $[[RES]], 0($[[S3_ADDR]])