Skip to content

Commit 1fa76cc

Browse files
author
Michael Berg
committedMay 18, 2018
adding baseline fp fold tests for unsafe on and off
llvm-svn: 332756
1 parent 08099c7 commit 1fa76cc

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
 

‎llvm/test/CodeGen/X86/fp-fold.ll

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=ANY,STRICT
3+
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -enable-unsafe-fp-math | FileCheck %s --check-prefixes=ANY,UNSAFE
4+
5+
; This is duplicated from tests for InstSimplify. If you're
6+
; adding something here, you should probably add it there too.
7+
8+
define float @fadd_zero_1(float %x) {
9+
; ANY-LABEL: fadd_zero_1:
10+
; ANY: # %bb.0:
11+
; ANY-NEXT: retq
12+
%r = fadd nsz float %x, 0.0
13+
ret float %r
14+
}
15+
16+
define float @fadd_zero_2(float %x) {
17+
; ANY-LABEL: fadd_zero_2:
18+
; ANY: # %bb.0:
19+
; ANY-NEXT: retq
20+
%r = fadd nsz float %x, -0.0
21+
ret float %r
22+
}
23+
24+
define float @fsub_zero_1(float %x) {
25+
; UNSAFE-LABEL: fsub_zero_1:
26+
; UNSAFE: # %bb.0:
27+
; UNSAFE-NEXT: retq
28+
%r = fsub float %x, 0.0
29+
ret float %r
30+
}
31+
32+
define float @fsub_zero_2(float %x) {
33+
; UNSAFE-LABEL: fsub_zero_2:
34+
; UNSAFE: # %bb.0:
35+
; UNSAFE-NEXT: retq
36+
%r = fsub float %x, -0.0
37+
ret float %r
38+
}
39+
40+
; TODO: handle x*0 for fast flags the same as unsafe
41+
define float @fmul_zero(float %x) {
42+
; STRICT-LABEL: fmul_zero:
43+
; STRICT: # %bb.0:
44+
; STRICT: xorps %xmm1, %xmm1
45+
; STRICT: mulss %xmm1, %xmm0
46+
; STRICT-NEXT: retq
47+
;
48+
; UNSAFE-LABEL: fmul_zero:
49+
; UNSAFE: # %bb.0:
50+
; UNSAFE: xorps %xmm0, %xmm0
51+
; UNSAFE-NEXT: retq
52+
%r = fmul nnan nsz float %x, 0.0
53+
ret float %r
54+
}
55+
56+
define float @fmul_one(float %x) {
57+
; ANY-LABEL: fmul_one:
58+
; ANY: # %bb.0:
59+
; ANY-NEXT: retq
60+
%r = fmul float %x, 1.0
61+
ret float %r
62+
}

0 commit comments

Comments
 (0)