1; RUN: llc < %s -march=sparc | FileCheck %s
2; RUN: llc < %s -march=sparcel | FileCheck %s --check-prefix=CHECK-LE
3
4;; Bitcast should not do a runtime conversion, but rather emit a
5;; constant into integer registers directly.
6
7; CHECK-LABEL: bitcast:
8; CHECK: sethi 1049856, %o0
9; CHECK: mov %g0, %o1
10; CHECK-LE: mov %g0, %o0
11; CHECK-LE: sethi 1049856, %o1
12define <2 x i32> @bitcast() {
13  %1 = bitcast double 5.0 to <2 x i32>
14  ret <2 x i32> %1
15}
16
17;; Same thing for a call using a double (which gets passed in integer
18;; registers)
19
20; CHECK-LABEL: test_call
21; CHECK: sethi 1049856, %o0
22; CHECK: mov %g0, %o1
23; CHECK-LE: mov %g0, %o0
24; CHECK-LE: sethi 1049856, %o1
25declare void @a(double)
26define void @test_call() {
27  call void @a(double 5.0)
28  ret void
29}
30
31;; And for a libcall emitted from the pow intrinsic.  (libcall
32;; emission happens after SelectionDAG type legalization, so is a bit
33;; different than a normal function call. This was crashing before,
34;; due to an earlier broken workaround for this issue.)
35
36; CHECK-LABEL: test_intrins_call
37; CHECK: sethi 1048576, %o0
38; CHECK: mov %g0, %o1
39; CHECK: mov %o0, %o2
40; CHECK: mov %o1, %o3
41; CHECK-LE: mov %g0, %o0
42; CHECK-LE: sethi 1048576, %o1
43declare double @llvm.pow.f64(double, double)
44define double @test_intrins_call() {
45  %1 = call double @llvm.pow.f64(double 2.0, double 2.0)
46  ret double %1
47}
48