From 7f95266166dc3fc8fcb3889384592ba47fbdb1b3 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sat, 15 Aug 2015 16:49:50 +0000 Subject: [PATCH 1/1] add test case to show current codegen git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245163 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/machine-combiner.ll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/CodeGen/X86/machine-combiner.ll b/test/CodeGen/X86/machine-combiner.ll index 82da87fb63d..3f64e3f8179 100644 --- a/test/CodeGen/X86/machine-combiner.ll +++ b/test/CodeGen/X86/machine-combiner.ll @@ -358,3 +358,27 @@ define <4 x double> @reassociate_muls_v4f64(<4 x double> %x0, <4 x double> %x1, ret <4 x double> %t2 } +; TODO: Verify that SSE and AVX scalar single-precision minimum ops are reassociated. + +define float @reassociate_mins_single(float %x0, float %x1, float %x2, float %x3) { +; SSE-LABEL: reassociate_mins_single: +; SSE: # BB#0: +; SSE-NEXT: divss %xmm1, %xmm0 +; SSE-NEXT: minss %xmm2, %xmm0 +; SSE-NEXT: minss %xmm3, %xmm0 +; SSE-NEXT: retq +; +; AVX-LABEL: reassociate_mins_single: +; AVX: # BB#0: +; AVX-NEXT: vdivss %xmm1, %xmm0, %xmm0 +; AVX-NEXT: vminss %xmm0, %xmm2, %xmm0 +; AVX-NEXT: vminss %xmm0, %xmm3, %xmm0 +; AVX-NEXT: retq + %t0 = fdiv float %x0, %x1 + %cmp1 = fcmp olt float %x2, %t0 + %sel1 = select i1 %cmp1, float %x2, float %t0 + %cmp2 = fcmp olt float %x3, %sel1 + %sel2 = select i1 %cmp2, float %x3, float %sel1 + ret float %sel2 +} + -- 2.34.1