From 35f3782f4a742da812456d640a1f02a274598e87 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 23 Aug 2007 12:15:20 +0000 Subject: [PATCH] gcc: 2007-08-23 Paolo Bonzini * config/i386/sse.md (*sse_and3, *sse_ior3, *sse_nand3, *sse_xor3): New. gcc/testsuite: 2007-08-23 Paolo Bonzini * gcc.target/i386/xorps-sse.c: New. * gcc.target/i386/xorps-sse2.c: New. From-SVN: r127735 --- gcc/ChangeLog | 5 ++ gcc/config/i386/sse.md | 55 +++++++++++++++++++--- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/gcc.target/i386/xorps-sse.c | 14 ++++++ gcc/testsuite/gcc.target/i386/xorps-sse2.c | 15 ++++++ 5 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/xorps-sse.c create mode 100644 gcc/testsuite/gcc.target/i386/xorps-sse2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 14cb46a3702..b8c7a21e41b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2007-08-23 Paolo Bonzini + + * config/i386/sse.md (*sse_and3, *sse_ior3, + *sse_nand3, *sse_xor3): New. + 2007-08-23 Uros Bizjak * config/i386/i386.h (PRINT_OPERAND_PUNCT_VALID_P): Add ';' code. diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 31fd293e7b6..07969375f1d 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -3773,10 +3773,21 @@ [(set (match_operand:SSEMODEI 0 "register_operand" "") (and:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "") (match_operand:SSEMODEI 2 "nonimmediate_operand" "")))] - "TARGET_SSE2" + "TARGET_SSE" "ix86_fixup_binary_operands_no_copy (AND, mode, operands);") -(define_insn "*and3" +(define_insn "*sse_and3" + [(set (match_operand:SSEMODEI 0 "register_operand" "=x") + (and:SSEMODEI + (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") + (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))] + "(TARGET_SSE && !TARGET_SSE2) + && ix86_binary_operator_ok (AND, mode, operands)" + "andps\t{%2, %0|%0, %2}" + [(set_attr "type" "sselog") + (set_attr "mode" "V4SF")]) + +(define_insn "*sse2_and3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (and:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") @@ -3787,6 +3798,16 @@ (set_attr "prefix_data16" "1") (set_attr "mode" "TI")]) +(define_insn "*sse_nand3" + [(set (match_operand:SSEMODEI 0 "register_operand" "=x") + (and:SSEMODEI + (not:SSEMODEI (match_operand:SSEMODEI 1 "register_operand" "0")) + (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))] + "(TARGET_SSE && !TARGET_SSE2)" + "andnps\t{%2, %0|%0, %2}" + [(set_attr "type" "sselog") + (set_attr "mode" "V4SF")]) + (define_insn "sse2_nand3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (and:SSEMODEI @@ -3831,10 +3852,21 @@ [(set (match_operand:SSEMODEI 0 "register_operand" "") (ior:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "") (match_operand:SSEMODEI 2 "nonimmediate_operand" "")))] - "TARGET_SSE2" + "TARGET_SSE" "ix86_fixup_binary_operands_no_copy (IOR, mode, operands);") -(define_insn "*ior3" +(define_insn "*sse_ior3" + [(set (match_operand:SSEMODEI 0 "register_operand" "=x") + (ior:SSEMODEI + (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") + (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))] + "(TARGET_SSE && !TARGET_SSE2) + && ix86_binary_operator_ok (IOR, mode, operands)" + "orps\t{%2, %0|%0, %2}" + [(set_attr "type" "sselog") + (set_attr "mode" "V4SF")]) + +(define_insn "*sse2_ior3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (ior:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") @@ -3867,10 +3899,21 @@ [(set (match_operand:SSEMODEI 0 "register_operand" "") (xor:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "") (match_operand:SSEMODEI 2 "nonimmediate_operand" "")))] - "TARGET_SSE2" + "TARGET_SSE" "ix86_fixup_binary_operands_no_copy (XOR, mode, operands);") -(define_insn "*xor3" +(define_insn "*sse_xor3" + [(set (match_operand:SSEMODEI 0 "register_operand" "=x") + (xor:SSEMODEI + (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") + (match_operand:SSEMODEI 2 "nonimmediate_operand" "xm")))] + "(TARGET_SSE && !TARGET_SSE2) + && ix86_binary_operator_ok (XOR, mode, operands)" + "xorps\t{%2, %0|%0, %2}" + [(set_attr "type" "sselog") + (set_attr "mode" "V4SF")]) + +(define_insn "*sse2_xor3" [(set (match_operand:SSEMODEI 0 "register_operand" "=x") (xor:SSEMODEI (match_operand:SSEMODEI 1 "nonimmediate_operand" "%0") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 24e419a9f19..ef446717706 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -11,6 +11,11 @@ * gfortran.dg/min_max_optional_3.f90: Remove. * gfortran.dg/min_max_optional_4.f90: Remove. +2007-08-23 Paolo Bonzini + + * gcc.target/i386/xorps-sse.c: New. + * gcc.target/i386/xorps-sse2.c: New. + 2007-08-23 Paolo Bonzini * gcc.target/i386/cmov3.c: Fix scan-assembler. diff --git a/gcc/testsuite/gcc.target/i386/xorps-sse.c b/gcc/testsuite/gcc.target/i386/xorps-sse.c new file mode 100644 index 00000000000..e9c0a2e7395 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/xorps-sse.c @@ -0,0 +1,14 @@ +/* Test that we generate xorps instruction when pxor is not available. */ +/* { dg-do compile } */ +/* { dg-options "-O -msse -mno-sse2" } */ +/* { dg-final { scan-assembler "xorps\[ \t\]" } } */ + +#define vector __attribute__ ((vector_size (16))) + +vector int i(vector int f) +{ + vector int g = { 0x80000000, 0, 0x80000000, 0 }; + vector int f_int = (vector int) f; + return (f_int ^ g); +} + diff --git a/gcc/testsuite/gcc.target/i386/xorps-sse2.c b/gcc/testsuite/gcc.target/i386/xorps-sse2.c new file mode 100644 index 00000000000..3c268b4cbaa --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/xorps-sse2.c @@ -0,0 +1,15 @@ +/* Test that we generate xorps when the result is used in FP math. */ +/* { dg-do compile } */ +/* { dg-options "-O -msse2 -mno-sse3" } */ +/* { dg-final { scan-assembler "xorps\[ \t\]" { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-not "pxor" { xfail *-*-* } } } */ + +#define vector __attribute__ ((vector_size (16))) + +vector float i(vector float f, vector float h) +{ + vector int g = { 0x80000000, 0, 0x80000000, 0 }; + vector int f_int = (vector int) f; + return ((vector float) (f_int ^ g)) + h; +} +