• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc %s -O0 -march=sparc -mcpu=ut699 -o - | FileCheck %s -check-prefix=NO_ROUND_FUNC
2; RUN: llc %s -O0 -march=sparc -mcpu=leon3 -mattr=+prvntroundchange -o - | FileCheck %s -check-prefix=NO_ROUND_FUNC
3
4; RUN: llc %s -O0 -march=sparc -mcpu=ut699 -mattr=-prvntroundchange -o - | FileCheck %s -check-prefix=ROUND_FUNC
5; RUN: llc %s -O0 -march=sparc -mcpu=leon3  -o - | FileCheck %s -check-prefix=ROUND_FUNC
6
7
8; NO_ROUND_FUNC-LABEL: test_round_change
9; NO_ROUND_FUNC-NOT: fesetround
10
11; ROUND_FUNC-LABEL: test_round_change
12; ROUND_FUNC: fesetround
13
14; ModuleID = '<stdin>'
15target datalayout = "E-m:e-p:32:32-i64:64-f128:64-n32-S64"
16target triple = "sparc-unknown--eabi"
17
18@.str = private unnamed_addr constant [17 x i8] c"-((-a)*b) != a*b\00", align 1
19@.str.1 = private unnamed_addr constant [7 x i8] c"test.c\00", align 1
20@__PRETTY_FUNCTION__.mult = private unnamed_addr constant [12 x i8] c"void mult()\00", align 1
21
22; Function Attrs: nounwind
23define void @test_round_change() #0 {
24entry:
25  %a = alloca double, align 8
26  %b = alloca double, align 8
27  %x = alloca float, align 4
28  store double 1.100000e+00, double* %a, align 8
29  store double 1.010000e+01, double* %b, align 8
30  store float 0x400921FA00000000, float* %x, align 4
31  %call = call i32 @fesetround(i32 2048) #2
32  %0 = load double, double* %a, align 8
33  %sub = fsub double -0.000000e+00, %0
34  %1 = load double, double* %b, align 8
35  %mul = fmul double %sub, %1
36  %sub1 = fsub double -0.000000e+00, %mul
37  %2 = load double, double* %a, align 8
38  %3 = load double, double* %b, align 8
39  %mul2 = fmul double %2, %3
40  %cmp = fcmp une double %sub1, %mul2
41  br i1 %cmp, label %cond.true, label %cond.false
42
43cond.true:                                        ; preds = %entry
44  br label %cond.end
45
46cond.false:                                       ; preds = %entry
47  call void @__assert_fail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i32 10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__PRETTY_FUNCTION__.mult, i32 0, i32 0)) #3
48  unreachable
49                                                  ; No predecessors!
50  br label %cond.end
51
52cond.end:                                         ; preds = %4, %cond.true
53  ret void
54}
55
56; Function Attrs: nounwind
57declare i32 @fesetround(i32) #0
58
59; Function Attrs: noreturn nounwind
60declare void @__assert_fail(i8*, i8*, i32, i8*) #1
61
62attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
63attributes #1 = { noreturn nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
64attributes #2 = { nounwind }
65attributes #3 = { noreturn nounwind }