1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=mips -mcpu=mips32 -relocation-model=pic \
3 ; RUN: < %s 2>&1 | FileCheck %s --check-prefix=32
4 ; RUN: llc -mtriple=mips -mcpu=mips32 -relocation-model=pic -mattr=+micromips \
5 ; RUN: < %s 2>&1 | FileCheck %s --check-prefix=MM
6 ; RUN: llc -mtriple=mips64 -mcpu=mips64 -relocation-model=pic \
7 ; RUN: < %s 2>&1 | FileCheck %s --check-prefix=64
15 ; 32: # %bb.0: # %entry
16 ; 32-NEXT: lui $2, %hi(_gp_disp)
17 ; 32-NEXT: addiu $2, $2, %lo(_gp_disp)
18 ; 32-NEXT: addu $1, $2, $25
19 ; 32-NEXT: lw $2, %got(x)($1)
20 ; 32-NEXT: lw $3, 0($2)
21 ; 32-NEXT: addiu $4, $1, %got(b)
22 ; 32-NEXT: addiu $1, $1, %got(a)
23 ; 32-NEXT: movz $4, $1, $3
24 ; 32-NEXT: lw $1, 0($4)
25 ; 32-NEXT: lw $1, 0($1)
27 ; 32-NEXT: sw $1, 0($2)
30 ; MM: # %bb.0: # %entry
31 ; MM-NEXT: lui $2, %hi(_gp_disp)
32 ; MM-NEXT: addiu $2, $2, %lo(_gp_disp)
33 ; MM-NEXT: addu $2, $2, $25
34 ; MM-NEXT: lw $3, %got(x)($2)
35 ; MM-NEXT: lw16 $4, 0($3)
36 ; MM-NEXT: addiu $5, $2, %got(b)
37 ; MM-NEXT: addiu $1, $2, %got(a)
38 ; MM-NEXT: movz $5, $1, $4
39 ; MM-NEXT: lw16 $2, 0($5)
40 ; MM-NEXT: lw16 $2, 0($2)
41 ; MM-NEXT: sw16 $2, 0($3)
45 ; 64: # %bb.0: # %entry
46 ; 64-NEXT: lui $1, %hi(%neg(%gp_rel(foo)))
47 ; 64-NEXT: daddu $1, $1, $25
48 ; 64-NEXT: daddiu $1, $1, %lo(%neg(%gp_rel(foo)))
49 ; 64-NEXT: ld $2, %got_disp(x)($1)
50 ; 64-NEXT: lw $3, 0($2)
51 ; 64-NEXT: daddiu $4, $1, %got_disp(b)
52 ; 64-NEXT: daddiu $1, $1, %got_disp(a)
53 ; 64-NEXT: movz $4, $1, $3
54 ; 64-NEXT: ld $1, 0($4)
55 ; 64-NEXT: lw $1, 0($1)
57 ; 64-NEXT: sw $1, 0($2)
59 %0 = load i32, i32* @x, align 4
60 %cmp2 = icmp eq i32 %0, 0
61 %1 = load i32, i32* @a, align 4
62 %2 = load i32, i32* @b, align 4
63 %cond = select i1 %cmp2, i32 %1, i32 %2
64 store i32 %cond, i32* @x, align 4