[llvm-commits] [llvm] r42162 - in /llvm/trunk: lib/Target/X86/X86RegisterInfo.cpp test/CodeGen/X86/sse_reload_fold.ll
Dan Gohman
djg at cray.com
Thu Sep 20 07:17:21 PDT 2007
Author: djg
Date: Thu Sep 20 09:17:21 2007
New Revision: 42162
URL: http://llvm.org/viewvc/llvm-project?rev=42162&view=rev
Log:
Fix several more entries in the x86 reload/remat folding tables.
Added:
llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll
Modified:
llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=42162&r1=42161&r2=42162&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Sep 20 09:17:21 2007
@@ -711,10 +711,6 @@
{ X86::CMP32rr, X86::CMP32rm },
{ X86::CMP64rr, X86::CMP64rm },
{ X86::CMP8rr, X86::CMP8rm },
- { X86::CMPPDrri, X86::CMPPDrmi },
- { X86::CMPPSrri, X86::CMPPSrmi },
- { X86::CMPSDrr, X86::CMPSDrm },
- { X86::CMPSSrr, X86::CMPSSrm },
{ X86::CVTSD2SSrr, X86::CVTSD2SSrm },
{ X86::CVTSI2SD64rr, X86::CVTSI2SD64rm },
{ X86::CVTSI2SDrr, X86::CVTSI2SDrm },
@@ -795,6 +791,20 @@
{ X86::PSHUFHWri, X86::PSHUFHWmi },
{ X86::PSHUFLWri, X86::PSHUFLWmi },
{ X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 },
+ { X86::RCPPSr, X86::RCPPSm },
+ { X86::RCPPSr_Int, X86::RCPPSm_Int },
+ { X86::RSQRTPSr, X86::RSQRTPSm },
+ { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int },
+ { X86::RSQRTSSr, X86::RSQRTSSm },
+ { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int },
+ { X86::SQRTPDr, X86::SQRTPDm },
+ { X86::SQRTPDr_Int, X86::SQRTPDm_Int },
+ { X86::SQRTPSr, X86::SQRTPSm },
+ { X86::SQRTPSr_Int, X86::SQRTPSm_Int },
+ { X86::SQRTSDr, X86::SQRTSDm },
+ { X86::SQRTSDr_Int, X86::SQRTSDm_Int },
+ { X86::SQRTSSr, X86::SQRTSSm },
+ { X86::SQRTSSr_Int, X86::SQRTSSm_Int },
{ X86::TEST16rr, X86::TEST16rm },
{ X86::TEST32rr, X86::TEST32rm },
{ X86::TEST64rr, X86::TEST64rm },
@@ -875,6 +885,10 @@
{ X86::CMOVS16rr, X86::CMOVS16rm },
{ X86::CMOVS32rr, X86::CMOVS32rm },
{ X86::CMOVS64rr, X86::CMOVS64rm },
+ { X86::CMPPDrri, X86::CMPPDrmi },
+ { X86::CMPPSrri, X86::CMPPSrmi },
+ { X86::CMPSDrr, X86::CMPSDrm },
+ { X86::CMPSSrr, X86::CMPSSrm },
{ X86::DIVPDrr, X86::DIVPDrm },
{ X86::DIVPSrr, X86::DIVPSrm },
{ X86::DIVSDrr, X86::DIVSDrm },
@@ -965,24 +979,10 @@
{ X86::PUNPCKLQDQrr, X86::PUNPCKLQDQrm },
{ X86::PUNPCKLWDrr, X86::PUNPCKLWDrm },
{ X86::PXORrr, X86::PXORrm },
- { X86::RCPPSr, X86::RCPPSm },
- { X86::RCPPSr_Int, X86::RCPPSm_Int },
- { X86::RSQRTPSr, X86::RSQRTPSm },
- { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int },
- { X86::RSQRTSSr, X86::RSQRTSSm },
- { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int },
{ X86::SBB32rr, X86::SBB32rm },
{ X86::SBB64rr, X86::SBB64rm },
{ X86::SHUFPDrri, X86::SHUFPDrmi },
{ X86::SHUFPSrri, X86::SHUFPSrmi },
- { X86::SQRTPDr, X86::SQRTPDm },
- { X86::SQRTPDr_Int, X86::SQRTPDm_Int },
- { X86::SQRTPSr, X86::SQRTPSm },
- { X86::SQRTPSr_Int, X86::SQRTPSm_Int },
- { X86::SQRTSDr, X86::SQRTSDm },
- { X86::SQRTSDr_Int, X86::SQRTSDm_Int },
- { X86::SQRTSSr, X86::SQRTSSm },
- { X86::SQRTSSr_Int, X86::SQRTSSm_Int },
{ X86::SUB16rr, X86::SUB16rm },
{ X86::SUB32rr, X86::SUB32rm },
{ X86::SUB64rr, X86::SUB64rm },
Added: llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll?rev=42162&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll (added)
+++ llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll Thu Sep 20 09:17:21 2007
@@ -0,0 +1,124 @@
+; RUN: llvm-as < %s | \
+; RUN: llc -march=x86-64 -mattr=+64bit,+sse3 -print-failed-fuse-candidates |& \
+; RUN: grep fail | count 1
+
+declare void @bar()
+declare <4 x float> @qux()
+declare <2 x double> @pin()
+declare float @llvm.sqrt.f32(float)
+declare double @llvm.sqrt.f64(double)
+
+declare <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float>)
+declare <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float>)
+declare <4 x float> @llvm.x86.sse.rcp.ps(<4 x float>)
+declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>)
+declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>)
+declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8)
+declare <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float>, <4 x float>)
+declare <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float>, <4 x float>)
+declare <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float>, <4 x float>)
+declare <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double>)
+declare <2 x double> @llvm.x86.sse2.min.pd(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.x86.sse2.max.pd(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double>, <2 x double>, i8)
+declare <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double>, <2 x double>)
+declare <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double>, <2 x double>)
+
+define float @foo(float %f) {
+ call void @bar()
+ %t = call float @llvm.sqrt.f32(float %f)
+ ret float %t
+}
+define double @doo(double %f) {
+ call void @bar()
+ %t = call double @llvm.sqrt.f64(double %f)
+ ret double %t
+}
+define <4 x float> @a0(<4 x float> %f) {
+ call void @bar()
+ %t = call <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @a1(<4 x float> %f) {
+ call void @bar()
+ %t = call <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @a2(<4 x float> %f) {
+ call void @bar()
+ %t = call <4 x float> @llvm.x86.sse.rcp.ps(<4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @b3(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> %y, <4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @b4(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> %y, <4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @b5(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %y, <4 x float> %f, i8 7)
+ ret <4 x float> %t
+}
+define <4 x float> @b6(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %y, <4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @b7(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %y, <4 x float> %f)
+ ret <4 x float> %t
+}
+define <4 x float> @b8(<4 x float> %f) {
+ %y = call <4 x float> @qux()
+ %t = call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %y, <4 x float> %f)
+ ret <4 x float> %t
+}
+define <2 x double> @c1(<2 x double> %f) {
+ call void @bar()
+ %t = call <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double> %f)
+ ret <2 x double> %t
+}
+define <2 x double> @d3(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %y, <2 x double> %f)
+ ret <2 x double> %t
+}
+define <2 x double> @d4(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %y, <2 x double> %f)
+ ret <2 x double> %t
+}
+define <2 x double> @d5(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %y, <2 x double> %f, i8 7)
+ ret <2 x double> %t
+}
+define <2 x double> @d6(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %y, <2 x double> %f)
+ ret <2 x double> %t
+}
+define <2 x double> @d7(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %y, <2 x double> %f)
+ ret <2 x double> %t
+}
+define <2 x double> @d8(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %y, <2 x double> %f)
+ ret <2 x double> %t
+}
+
+; This one should fail to fuse.
+define <2 x double> @z0(<2 x double> %f) {
+ %y = call <2 x double> @pin()
+ %t = call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %f, <2 x double> %y)
+ ret <2 x double> %t
+}
More information about the llvm-commits
mailing list