From ec8a2fa14d15f6a5cb26706f2d1ba6b2c3d58c77 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 11 Feb 2017 14:01:37 +0000 Subject: [PATCH] [X86][3DNow!] Add tests to ensure PFMAX/PFMIN are not commuted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294848 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/commute-3dnow.ll | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/test/CodeGen/X86/commute-3dnow.ll b/test/CodeGen/X86/commute-3dnow.ll index 647cbee9656..b7a01efe2d3 100644 --- a/test/CodeGen/X86/commute-3dnow.ll +++ b/test/CodeGen/X86/commute-3dnow.ll @@ -118,6 +118,70 @@ define void @commute_m_pfmul(x86_mmx *%a0, x86_mmx *%a1, x86_mmx *%a2) nounwind } declare x86_mmx @llvm.x86.3dnow.pfmul(x86_mmx, x86_mmx) +; PFMAX can't commute without fast-math. +define void @commute_m_pfmax(x86_mmx *%a0, x86_mmx *%a1, x86_mmx *%a2) nounwind { +; X32-LABEL: commute_m_pfmax: +; X32: # BB#0: +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx +; X32-NEXT: movq (%edx), %mm0 +; X32-NEXT: movq (%ecx), %mm1 +; X32-NEXT: pfmax (%eax), %mm0 +; X32-NEXT: pfmax %mm0, %mm1 +; X32-NEXT: movq %mm1, (%ecx) +; X32-NEXT: retl +; +; X64-LABEL: commute_m_pfmax: +; X64: # BB#0: +; X64-NEXT: movq (%rdi), %mm0 +; X64-NEXT: movq (%rdx), %mm1 +; X64-NEXT: pfmax (%rsi), %mm0 +; X64-NEXT: pfmax %mm0, %mm1 +; X64-NEXT: movq %mm1, (%rdx) +; X64-NEXT: retq + %1 = load x86_mmx, x86_mmx* %a0 + %2 = load x86_mmx, x86_mmx* %a1 + %3 = load x86_mmx, x86_mmx* %a2 + %4 = tail call x86_mmx @llvm.x86.3dnow.pfmax(x86_mmx %1, x86_mmx %2) + %5 = tail call x86_mmx @llvm.x86.3dnow.pfmax(x86_mmx %3, x86_mmx %4) + store x86_mmx %5, x86_mmx* %a2 + ret void +} +declare x86_mmx @llvm.x86.3dnow.pfmax(x86_mmx, x86_mmx) + +; PFMIN can't commute without fast-math. +define void @commute_m_pfmin(x86_mmx *%a0, x86_mmx *%a1, x86_mmx *%a2) nounwind { +; X32-LABEL: commute_m_pfmin: +; X32: # BB#0: +; X32-NEXT: movl {{[0-9]+}}(%esp), %eax +; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx +; X32-NEXT: movl {{[0-9]+}}(%esp), %edx +; X32-NEXT: movq (%edx), %mm0 +; X32-NEXT: movq (%ecx), %mm1 +; X32-NEXT: pfmin (%eax), %mm0 +; X32-NEXT: pfmin %mm0, %mm1 +; X32-NEXT: movq %mm1, (%ecx) +; X32-NEXT: retl +; +; X64-LABEL: commute_m_pfmin: +; X64: # BB#0: +; X64-NEXT: movq (%rdi), %mm0 +; X64-NEXT: movq (%rdx), %mm1 +; X64-NEXT: pfmin (%rsi), %mm0 +; X64-NEXT: pfmin %mm0, %mm1 +; X64-NEXT: movq %mm1, (%rdx) +; X64-NEXT: retq + %1 = load x86_mmx, x86_mmx* %a0 + %2 = load x86_mmx, x86_mmx* %a1 + %3 = load x86_mmx, x86_mmx* %a2 + %4 = tail call x86_mmx @llvm.x86.3dnow.pfmin(x86_mmx %1, x86_mmx %2) + %5 = tail call x86_mmx @llvm.x86.3dnow.pfmin(x86_mmx %3, x86_mmx %4) + store x86_mmx %5, x86_mmx* %a2 + ret void +} +declare x86_mmx @llvm.x86.3dnow.pfmin(x86_mmx, x86_mmx) + define void @commute_m_pfcmpeq(x86_mmx *%a0, x86_mmx *%a1, x86_mmx *%a2) nounwind { ; X32-LABEL: commute_m_pfcmpeq: ; X32: # BB#0: