[llvm] r332780 - [x86] add more FP with FMF simplification tests; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri May 18 15:31:43 PDT 2018
Author: spatel
Date: Fri May 18 15:31:43 2018
New Revision: 332780
URL: http://llvm.org/viewvc/llvm-project?rev=332780&view=rev
Log:
[x86] add more FP with FMF simplification tests; NFC
Modified:
llvm/trunk/test/CodeGen/X86/fp-fold.ll
Modified: llvm/trunk/test/CodeGen/X86/fp-fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-fold.ll?rev=332780&r1=332779&r2=332780&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-fold.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-fold.ll Fri May 18 15:31:43 2018
@@ -2,52 +2,103 @@
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=ANY,STRICT
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -enable-unsafe-fp-math | FileCheck %s --check-prefixes=ANY,UNSAFE
-; This is duplicated from tests for InstSimplify. If you're
-; adding something here, you should probably add it there too.
+define float @fadd_zero(float %x) {
+; STRICT-LABEL: fadd_zero:
+; STRICT: # %bb.0:
+; STRICT-NEXT: xorps %xmm1, %xmm1
+; STRICT-NEXT: addss %xmm1, %xmm0
+; STRICT-NEXT: retq
+;
+; UNSAFE-LABEL: fadd_zero:
+; UNSAFE: # %bb.0:
+; UNSAFE-NEXT: retq
+ %r = fadd float %x, 0.0
+ ret float %r
+}
+
+define float @fadd_negzero(float %x) {
+; STRICT-LABEL: fadd_negzero:
+; STRICT: # %bb.0:
+; STRICT-NEXT: addss {{.*}}(%rip), %xmm0
+; STRICT-NEXT: retq
+;
+; UNSAFE-LABEL: fadd_negzero:
+; UNSAFE: # %bb.0:
+; UNSAFE-NEXT: retq
+ %r = fadd float %x, -0.0
+ ret float %r
+}
-define float @fadd_zero_1(float %x) {
-; ANY-LABEL: fadd_zero_1:
+define float @fadd_zero_nsz(float %x) {
+; ANY-LABEL: fadd_zero_nsz:
; ANY: # %bb.0:
; ANY-NEXT: retq
%r = fadd nsz float %x, 0.0
ret float %r
}
-define float @fadd_zero_2(float %x) {
-; ANY-LABEL: fadd_zero_2:
+define float @fadd_negzero_nsz(float %x) {
+; ANY-LABEL: fadd_negzero_nsz:
; ANY: # %bb.0:
; ANY-NEXT: retq
%r = fadd nsz float %x, -0.0
ret float %r
}
-define float @fsub_zero_1(float %x) {
-; UNSAFE-LABEL: fsub_zero_1:
+define float @fsub_zero(float %x) {
+; STRICT-LABEL: fsub_zero:
+; STRICT: # %bb.0:
+; STRICT-NEXT: addss {{.*}}(%rip), %xmm0
+; STRICT-NEXT: retq
+;
+; UNSAFE-LABEL: fsub_zero:
; UNSAFE: # %bb.0:
; UNSAFE-NEXT: retq
%r = fsub float %x, 0.0
ret float %r
}
-define float @fsub_zero_2(float %x) {
-; UNSAFE-LABEL: fsub_zero_2:
+define float @fsub_negzero(float %x) {
+; STRICT-LABEL: fsub_negzero:
+; STRICT: # %bb.0:
+; STRICT-NEXT: xorps %xmm1, %xmm1
+; STRICT-NEXT: addss %xmm1, %xmm0
+; STRICT-NEXT: retq
+;
+; UNSAFE-LABEL: fsub_negzero:
; UNSAFE: # %bb.0:
; UNSAFE-NEXT: retq
%r = fsub float %x, -0.0
ret float %r
}
+define float @fsub_zero_nsz(float %x) {
+; ANY-LABEL: fsub_zero_nsz:
+; ANY: # %bb.0:
+; ANY-NEXT: retq
+ %r = fsub nsz float %x, 0.0
+ ret float %r
+}
+
+define float @fsub_negzero_nsz(float %x) {
+; ANY-LABEL: fsub_negzero_nsz:
+; ANY: # %bb.0:
+; ANY-NEXT: retq
+ %r = fsub nsz float %x, -0.0
+ ret float %r
+}
+
; TODO: handle x*0 for fast flags the same as unsafe
define float @fmul_zero(float %x) {
; STRICT-LABEL: fmul_zero:
; STRICT: # %bb.0:
-; STRICT: xorps %xmm1, %xmm1
-; STRICT: mulss %xmm1, %xmm0
+; STRICT-NEXT: xorps %xmm1, %xmm1
+; STRICT-NEXT: mulss %xmm1, %xmm0
; STRICT-NEXT: retq
;
; UNSAFE-LABEL: fmul_zero:
; UNSAFE: # %bb.0:
-; UNSAFE: xorps %xmm0, %xmm0
+; UNSAFE-NEXT: xorps %xmm0, %xmm0
; UNSAFE-NEXT: retq
%r = fmul nnan nsz float %x, 0.0
ret float %r
More information about the llvm-commits
mailing list