File: getpcx-call.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (51 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download | duplicates (8)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -relocation-model=pic -mtriple=sparc | FileCheck --check-prefix=SPARC %s
; RUN: llc < %s -relocation-model=pic -mtriple=sparcv9 | FileCheck --check-prefix=SPARC64 %s

;; SPARC32 and SPARC64 for classic UltraSPARCs implement GETPCX
;; with a fake `call`.
;; All other SPARC64 targets implement it with `rd %pc, %o7`.
;; Need to do the tests in separate files because apparently `tune-cpu`
;; attribute applies to the entire file at once.

@value = external global i32

define i32 @testCall() nounwind #0 {
; SPARC-LABEL: testCall:
; SPARC:       ! %bb.0:
; SPARC-NEXT:    save %sp, -96, %sp
; SPARC-NEXT:  .Ltmp0:
; SPARC-NEXT:    call .Ltmp1
; SPARC-NEXT:  .Ltmp2:
; SPARC-NEXT:    sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp2-.Ltmp0)), %i0
; SPARC-NEXT:  .Ltmp1:
; SPARC-NEXT:    or %i0, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.Ltmp0)), %i0
; SPARC-NEXT:    add %i0, %o7, %i0
; SPARC-NEXT:    sethi %hi(value), %i1
; SPARC-NEXT:    add %i1, %lo(value), %i1
; SPARC-NEXT:    ld [%i0+%i1], %i0
; SPARC-NEXT:    ld [%i0], %i0
; SPARC-NEXT:    ret
; SPARC-NEXT:    restore
;
; SPARC64-LABEL: testCall:
; SPARC64:       ! %bb.0:
; SPARC64-NEXT:    save %sp, -128, %sp
; SPARC64-NEXT:  .Ltmp0:
; SPARC64-NEXT:    call .Ltmp1
; SPARC64-NEXT:  .Ltmp2:
; SPARC64-NEXT:    sethi %hi(_GLOBAL_OFFSET_TABLE_+(.Ltmp2-.Ltmp0)), %i0
; SPARC64-NEXT:  .Ltmp1:
; SPARC64-NEXT:    or %i0, %lo(_GLOBAL_OFFSET_TABLE_+(.Ltmp1-.Ltmp0)), %i0
; SPARC64-NEXT:    add %i0, %o7, %i0
; SPARC64-NEXT:    sethi %hi(value), %i1
; SPARC64-NEXT:    add %i1, %lo(value), %i1
; SPARC64-NEXT:    ldx [%i0+%i1], %i0
; SPARC64-NEXT:    ld [%i0], %i0
; SPARC64-NEXT:    ret
; SPARC64-NEXT:    restore
  %1 = load i32, ptr @value
  ret i32 %1
}

attributes #0 = { "tune-cpu"="ultrasparc" }