File: mips_gprel16.ll

package info (click to toggle)
llvm-toolchain-3.4 1%3A3.4.2-13
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 253,236 kB
  • ctags: 276,203
  • sloc: cpp: 1,665,580; ansic: 298,647; asm: 206,157; objc: 84,350; python: 73,119; sh: 23,466; perl: 5,679; makefile: 5,542; ml: 5,250; pascal: 2,467; lisp: 1,420; xml: 679; cs: 236; csh: 117
file content (33 lines) | stat: -rw-r--r-- 930 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
; This addresses bug 14456. We were not writing
; out the addend to the gprel16 relocation. The
; addend is stored in the instruction immediate 
; field.
;llc gprel16.ll -o gprel16.o -mcpu=mips32r2 -march=mipsel -filetype=obj -relocation-model=static

; RUN: llc -mcpu=mips32r2 -march=mipsel -filetype=obj -relocation-model=static %s -o - \
; RUN: | llvm-objdump -disassemble -mattr +mips32r2 - \
; RUN: | FileCheck %s

target triple = "mipsel-sde--elf-gcc"

@var1 = internal global i32 0, align 4
@var2 = internal global i32 0, align 4

define i32 @testvar1() nounwind {
entry:
; CHECK: lw ${{[0-9]+}}, 0($gp)
  %0 = load i32* @var1, align 4
  %tobool = icmp ne i32 %0, 0
  %cond = select i1 %tobool, i32 1, i32 0
  ret i32 %cond
}

define i32 @testvar2() nounwind {
entry:
; CHECK: lw ${{[0-9]+}}, 4($gp)
  %0 = load i32* @var2, align 4
  %tobool = icmp ne i32 %0, 0
  %cond = select i1 %tobool, i32 1, i32 0
  ret i32 %cond
}