File: float-constants.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 (80 lines) | stat: -rw-r--r-- 2,411 bytes parent folder | download | duplicates (6)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
; RUN: llc < %s -march=sparc | FileCheck %s
; RUN: llc < %s -march=sparcel | FileCheck %s --check-prefix=CHECK-LE

;; Bitcast should not do a runtime conversion, but rather emit a
;; constant into integer registers directly.

define <2 x i32> @bitcast() nounwind {
; CHECK-LABEL: bitcast:
; CHECK:       ! %bb.0:
; CHECK-NEXT:    sethi 1049856, %o0
; CHECK-NEXT:    retl
; CHECK-NEXT:    mov %g0, %o1
;
; CHECK-LE-LABEL: bitcast:
; CHECK-LE:       ! %bb.0:
; CHECK-LE-NEXT:    sethi 1049856, %o1
; CHECK-LE-NEXT:    retl
; CHECK-LE-NEXT:    mov %g0, %o0
  %1 = bitcast double 5.0 to <2 x i32>
  ret <2 x i32> %1
}

;; Same thing for a call using a double (which gets passed in integer
;; registers)

declare void @a(double)
define void @test_call() nounwind {
; CHECK-LABEL: test_call:
; CHECK:       ! %bb.0:
; CHECK-NEXT:    save %sp, -96, %sp
; CHECK-NEXT:    sethi 1049856, %o0
; CHECK-NEXT:    call a
; CHECK-NEXT:    mov %g0, %o1
; CHECK-NEXT:    ret
; CHECK-NEXT:    restore
;
; CHECK-LE-LABEL: test_call:
; CHECK-LE:       ! %bb.0:
; CHECK-LE-NEXT:    save %sp, -96, %sp
; CHECK-LE-NEXT:    sethi 1049856, %o1
; CHECK-LE-NEXT:    call a
; CHECK-LE-NEXT:    mov %g0, %o0
; CHECK-LE-NEXT:    ret
; CHECK-LE-NEXT:    restore
  call void @a(double 5.0)
  ret void
}

;; And for a libcall emitted from the pow intrinsic.  (libcall
;; emission happens after SelectionDAG type legalization, so is a bit
;; different than a normal function call. This was crashing before,
;; due to an earlier broken workaround for this issue.)

declare double @llvm.pow.f64(double, double)
define double @test_intrins_call() nounwind {
; CHECK-LABEL: test_intrins_call:
; CHECK:       ! %bb.0:
; CHECK-NEXT:    save %sp, -96, %sp
; CHECK-NEXT:    sethi 1048576, %o0
; CHECK-NEXT:    mov %g0, %o1
; CHECK-NEXT:    mov %o0, %o2
; CHECK-NEXT:    call pow
; CHECK-NEXT:    mov %g0, %o3
; CHECK-NEXT:    ret
; CHECK-NEXT:    restore
;
; CHECK-LE-LABEL: test_intrins_call:
; CHECK-LE:       ! %bb.0:
; CHECK-LE-NEXT:    save %sp, -96, %sp
; CHECK-LE-NEXT:    sethi 1048576, %o1
; CHECK-LE-NEXT:    mov %g0, %o0
; CHECK-LE-NEXT:    mov %g0, %o2
; CHECK-LE-NEXT:    call pow
; CHECK-LE-NEXT:    mov %o1, %o3
; CHECK-LE-NEXT:    ret
; CHECK-LE-NEXT:    restore
  %1 = call double @llvm.pow.f64(double 2.0, double 2.0)
  ret double %1
}