Commit 96038623 by David Edelsohn Committed by Revital Eres

Support for PowerPC 750CL paired-single instructions

Co-Authored-By: Revital Eres <eres@il.ibm.com>

From-SVN: r127954
parent 6e03b280
2007-08-31 David Edelsohn <edelsohn@gnu.org>
Revital Eres <eres@il.ibm.com>
* doc/invoke.texi (-mpaired): Document flag.
* config.gcc: Include paired.h in powerpc extra_headers and
750cl.h in powerpc-*-linux*paired*.
* config/rs6000/rs6000.opt (-mpaired): New flag.
* config/rs6000/rs6000.c (paired_init_builtins,
paired_expand_builtin, paired_expand_lv_builtin,
paired_expand_stv_builtin, paired_expand_predicate_builtin):
New functions to support the paired single builtin functions.
(rs6000_hard_regno_mode_ok): Handle PAIRED_VECTOR_MODE.
(def_builtin, bdesc_3arg, bdesc_2arg, bdesc_1arg): Add paired
single builtins.
(bdesc_paired_preds): New structure for paired predicate
instructions.
(rs6000_expand_builtin): Expand paired single builtins.
(rs6000_init_builtins): Init paired single builtins.
(rs6000_common_init_builtins): Add v2sf_ftype_v2sf_v2sf_v2sf.
Rename v2sf_ftype_v2sf_v2sf to v2sf_ftype_v2sf_v2sf_spe
and v2sf_ftype_v2sf_spe to v2sf_ftype_v2sf. Add new types
v2sf_ftype_v2sf_v2sf and v2sf_ftype_v2sf.
(rs6000_vector_mode_supported_p): Support paired vector mode.
* config/rs6000/rs6000.h: (UNITS_PER_PAIRED_WORD,
PAIRED_VECTOR_MODE, PAIRED_SIMD_REGNO_P, TARGET_PAIRED_FLOAT):
New.
(LOCAL_ALIGNMENT): Handle PAIRED_VECTOR_MODE.
(DATA_ALIGNMENT): Likewise.
(UNITS_PER_SIMD_WORD): Handle PAIRED_VECTOR_MODE.
(rs6000_builtins): Add PAIRED builtins.
* config/rs6000/rs6000.md: Include paired.md.
* config/rs6000/paired.h: New.
* config/rs6000/paired.md: New.
* config/rs6000/750cl.h: New.
* config/rs6000/spe.md: Recognize movv2sf instruction for 750cl.
2007-08-30 Ollie Wild <aaw@google.com> 2007-08-30 Ollie Wild <aaw@google.com>
* c-opts.c (c_common_handle_option): Support -fno-directives-only. * c-opts.c (c_common_handle_option): Support -fno-directives-only.
......
...@@ -312,7 +312,7 @@ mips*-*-*) ...@@ -312,7 +312,7 @@ mips*-*-*)
;; ;;
powerpc*-*-*) powerpc*-*-*)
cpu_type=rs6000 cpu_type=rs6000
extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h" extra_headers="ppc-asm.h altivec.h spe.h ppu_intrinsics.h paired.h"
need_64bit_hwint=yes need_64bit_hwint=yes
case x$with_cpu in case x$with_cpu in
xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456]|xpower6x|xrs64a) xpowerpc64|xdefault64|x6[23]0|x970|xG5|xpower[3456]|xpower6x|xrs64a)
...@@ -1936,6 +1936,11 @@ powerpc-*-linux*spe*) ...@@ -1936,6 +1936,11 @@ powerpc-*-linux*spe*)
extra_options="${extra_options} rs6000/sysv4.opt" extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm" tmake_file="rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
;; ;;
powerpc-*-linux*paired*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h rs6000/linux.h rs6000/750cl.h"
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="rs6000/t-fprules rs6000/t-fprules-softfp soft-fp/t-softfp rs6000/t-ppcos ${tmake_file} rs6000/t-ppccomm"
;;
powerpc-*-linux*) powerpc-*-linux*)
tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h" tm_file="${tm_file} dbxelf.h elfos.h svr4.h freebsd-spec.h rs6000/sysv4.h"
extra_options="${extra_options} rs6000/sysv4.opt" extra_options="${extra_options} rs6000/sysv4.opt"
......
/* Enable 750cl paired single support.
Copyright (C) 2007 Free Software Foundation, Inc.
Contributed by Revital Eres (eres@il.ibm.com)
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#undef TARGET_PAIRED_FLOAT
#define TARGET_PAIRED_FLOAT rs6000_paired_float
/* PowerPC 750CL user include file.
Copyright (C) 2007 Free Software Foundation, Inc.
Contributed by Revital Eres (eres@il.ibm.com).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2, or (at your
option) any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
/* As a special exception, if you include this header file into source
files compiled by GCC, this header file does not by itself cause
the resulting executable to be covered by the GNU General Public
License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General
Public License. */
#ifndef _PAIRED_H
#define _PAIRED_H
#define vector __attribute__((vector_size(8)))
#define paired_msub __builtin_paired_msub
#define paired_madd __builtin_paired_madd
#define paired_nmsub __builtin_paired_nmsub
#define paired_nmadd __builtin_paired_nmadd
#define paired_sum0 __builtin_paired_sum0
#define paired_sum1 __builtin_paired_sum1
#define paired_div __builtin_paired_divv2sf3
#define paired_add __builtin_paired_addv2sf3
#define paired_sub __builtin_paired_subv2sf3
#define paired_mul __builtin_paired_mulv2sf3
#define paired_muls0 __builtin_paired_muls0
#define paired_muls1 __builtin_paired_muls1
#define paired_madds0 __builtin_paired_madds0
#define paired_madds1 __builtin_paired_madds1
#define paired_merge00 __builtin_paired_merge00
#define paired_merge01 __builtin_paired_merge01
#define paired_merge10 __builtin_paired_merge10
#define paired_merge11 __builtin_paired_merge11
#define paired_abs __builtin_paired_absv2sf2
#define paired_nabs __builtin_paired_nabsv2sf2
#define paired_neg __builtin_paired_negv2sf2
#define paired_sqrt __builtin_paired_sqrtv2sf2
#define paired_res __builtin_paired_resv2sf2
#define paired_stx __builtin_paired_stx
#define paired_lx __builtin_paired_lx
#define paired_cmpu0 __builtin_paired_cmpu0
#define paired_cmpu1 __builtin_paired_cmpu1
/* Condition register codes for Paired predicates. */
#define LT 0
#define GT 1
#define EQ 2
#define UN 3
#define paired_cmpu0_un(a,b) __builtin_paired_cmpu0 (UN, (a), (b))
#define paired_cmpu0_eq(a,b) __builtin_paired_cmpu0 (EQ, (a), (b))
#define paired_cmpu0_lt(a,b) __builtin_paired_cmpu0 (LT, (a), (b))
#define paired_cmpu0_gt(a,b) __builtin_paired_cmpu0 (GT, (a), (b))
#define paired_cmpu1_un(a,b) __builtin_paired_cmpu1 (UN, (a), (b))
#define paired_cmpu1_eq(a,b) __builtin_paired_cmpu1 (EQ, (a), (b))
#define paired_cmpu1_lt(a,b) __builtin_paired_cmpu1 (LT, (a), (b))
#define paired_cmpu1_gt(a,b) __builtin_paired_cmpu1 (GT, (a), (b))
#endif /* _PAIRED_H */
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
#define PPC405_ERRATUM77 0 #define PPC405_ERRATUM77 0
#endif #endif
#ifndef TARGET_PAIRED_FLOAT
#define TARGET_PAIRED_FLOAT 0
#endif
/* Common ASM definitions used by ASM_SPEC among the various targets /* Common ASM definitions used by ASM_SPEC among the various targets
for handling -mcpu=xxx switches. */ for handling -mcpu=xxx switches. */
#define ASM_CPU_SPEC \ #define ASM_CPU_SPEC \
...@@ -472,6 +476,7 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; ...@@ -472,6 +476,7 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
#define UNITS_PER_FP_WORD 8 #define UNITS_PER_FP_WORD 8
#define UNITS_PER_ALTIVEC_WORD 16 #define UNITS_PER_ALTIVEC_WORD 16
#define UNITS_PER_SPE_WORD 8 #define UNITS_PER_SPE_WORD 8
#define UNITS_PER_PAIRED_WORD 8
/* Type used for ptrdiff_t, as a string used in a declaration. */ /* Type used for ptrdiff_t, as a string used in a declaration. */
#define PTRDIFF_TYPE "int" #define PTRDIFF_TYPE "int"
...@@ -555,8 +560,10 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; ...@@ -555,8 +560,10 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
#define LOCAL_ALIGNMENT(TYPE, ALIGN) \ #define LOCAL_ALIGNMENT(TYPE, ALIGN) \
((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) ? 128 : \ ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) ? 128 : \
(TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 : \ (TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 : \
(TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE \ ((TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE \
&& SPE_VECTOR_MODE (TYPE_MODE (TYPE))) ? 64 : ALIGN) && SPE_VECTOR_MODE (TYPE_MODE (TYPE))) || (TARGET_PAIRED_FLOAT \
&& TREE_CODE (TYPE) == VECTOR_TYPE \
&& PAIRED_VECTOR_MODE (TYPE_MODE (TYPE)))) ? 64 : ALIGN)
/* Alignment of field after `int : 0' in a structure. */ /* Alignment of field after `int : 0' in a structure. */
#define EMPTY_FIELD_BOUNDARY 32 #define EMPTY_FIELD_BOUNDARY 32
...@@ -595,7 +602,8 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; ...@@ -595,7 +602,8 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
Align vectors to 128 bits. Align SPE vectors and E500 v2 doubles to Align vectors to 128 bits. Align SPE vectors and E500 v2 doubles to
64 bits. */ 64 bits. */
#define DATA_ALIGNMENT(TYPE, ALIGN) \ #define DATA_ALIGNMENT(TYPE, ALIGN) \
(TREE_CODE (TYPE) == VECTOR_TYPE ? (TARGET_SPE_ABI ? 64 : 128) \ (TREE_CODE (TYPE) == VECTOR_TYPE ? ((TARGET_SPE_ABI \
|| TARGET_PAIRED_FLOAT) ? 64 : 128) \
: (TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 \ : (TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 \
: TREE_CODE (TYPE) == ARRAY_TYPE \ : TREE_CODE (TYPE) == ARRAY_TYPE \
&& TYPE_MODE (TREE_TYPE (TYPE)) == QImode \ && TYPE_MODE (TREE_TYPE (TYPE)) == QImode \
...@@ -831,6 +839,9 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; ...@@ -831,6 +839,9 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
/* SPE SIMD registers are just the GPRs. */ /* SPE SIMD registers are just the GPRs. */
#define SPE_SIMD_REGNO_P(N) ((N) <= 31) #define SPE_SIMD_REGNO_P(N) ((N) <= 31)
/* PAIRED SIMD registers are just the FPRs. */
#define PAIRED_SIMD_REGNO_P(N) ((N) >= 32 && (N) <= 63)
/* True if register is the XER register. */ /* True if register is the XER register. */
#define XER_REGNO_P(N) ((N) == XER_REGNO) #define XER_REGNO_P(N) ((N) == XER_REGNO)
...@@ -859,9 +870,13 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops; ...@@ -859,9 +870,13 @@ extern enum rs6000_nop_insertion rs6000_sched_insert_nops;
|| (MODE) == V1DImode \ || (MODE) == V1DImode \
|| (MODE) == V2SImode) || (MODE) == V2SImode)
#define UNITS_PER_SIMD_WORD \ #define PAIRED_VECTOR_MODE(MODE) \
(TARGET_ALTIVEC ? UNITS_PER_ALTIVEC_WORD \ ((MODE) == V2SFmode)
: (TARGET_SPE ? UNITS_PER_SPE_WORD : UNITS_PER_WORD))
#define UNITS_PER_SIMD_WORD \
(TARGET_ALTIVEC ? UNITS_PER_ALTIVEC_WORD \
: (TARGET_SPE ? UNITS_PER_SPE_WORD : (TARGET_PAIRED_FLOAT ? \
UNITS_PER_PAIRED_WORD : UNITS_PER_WORD)))
/* Value is TRUE if hard register REGNO can hold a value of /* Value is TRUE if hard register REGNO can hold a value of
machine-mode MODE. */ machine-mode MODE. */
...@@ -2949,6 +2964,35 @@ enum rs6000_builtins ...@@ -2949,6 +2964,35 @@ enum rs6000_builtins
SPE_BUILTIN_MFSPEFSCR, SPE_BUILTIN_MFSPEFSCR,
SPE_BUILTIN_BRINC, SPE_BUILTIN_BRINC,
/* PAIRED builtins. */
PAIRED_BUILTIN_DIVV2SF3,
PAIRED_BUILTIN_ABSV2SF2,
PAIRED_BUILTIN_NEGV2SF2,
PAIRED_BUILTIN_SQRTV2SF2,
PAIRED_BUILTIN_ADDV2SF3,
PAIRED_BUILTIN_SUBV2SF3,
PAIRED_BUILTIN_RESV2SF2,
PAIRED_BUILTIN_MULV2SF3,
PAIRED_BUILTIN_MSUB,
PAIRED_BUILTIN_MADD,
PAIRED_BUILTIN_NMSUB,
PAIRED_BUILTIN_NMADD,
PAIRED_BUILTIN_NABSV2SF2,
PAIRED_BUILTIN_SUM0,
PAIRED_BUILTIN_SUM1,
PAIRED_BUILTIN_MULS0,
PAIRED_BUILTIN_MULS1,
PAIRED_BUILTIN_MERGE00,
PAIRED_BUILTIN_MERGE01,
PAIRED_BUILTIN_MERGE10,
PAIRED_BUILTIN_MERGE11,
PAIRED_BUILTIN_MADDS0,
PAIRED_BUILTIN_MADDS1,
PAIRED_BUILTIN_STX,
PAIRED_BUILTIN_LX,
PAIRED_BUILTIN_CMPU0,
PAIRED_BUILTIN_CMPU1,
RS6000_BUILTIN_COUNT RS6000_BUILTIN_COUNT
}; };
......
...@@ -14568,3 +14568,4 @@ ...@@ -14568,3 +14568,4 @@
(include "altivec.md") (include "altivec.md")
(include "spe.md") (include "spe.md")
(include "dfp.md") (include "dfp.md")
(include "paired.md")
...@@ -201,6 +201,10 @@ mspe ...@@ -201,6 +201,10 @@ mspe
Target Var(rs6000_spe) Target Var(rs6000_spe)
Generate SPE SIMD instructions on E500 Generate SPE SIMD instructions on E500
mpaired
Target Var(rs6000_paired_float)
Generate PPC750CL paired-single instructions
mspe= mspe=
Target RejectNegative Joined Target RejectNegative Joined
-mspe=yes/no Deprecated option. Use -mspe/-mno-spe instead -mspe=yes/no Deprecated option. Use -mspe/-mno-spe instead
......
...@@ -2678,7 +2678,7 @@ ...@@ -2678,7 +2678,7 @@
(define_expand "movv2sf" (define_expand "movv2sf"
[(set (match_operand:V2SF 0 "nonimmediate_operand" "") [(set (match_operand:V2SF 0 "nonimmediate_operand" "")
(match_operand:V2SF 1 "any_operand" ""))] (match_operand:V2SF 1 "any_operand" ""))]
"TARGET_SPE" "TARGET_SPE || TARGET_PAIRED_FLOAT"
"{ rs6000_emit_move (operands[0], operands[1], V2SFmode); DONE; }") "{ rs6000_emit_move (operands[0], operands[1], V2SFmode); DONE; }")
(define_insn "*movv2sf_internal" (define_insn "*movv2sf_internal"
......
...@@ -704,6 +704,7 @@ See RS/6000 and PowerPC Options. ...@@ -704,6 +704,7 @@ See RS/6000 and PowerPC Options.
-misel=yes -misel=no @gol -misel=yes -misel=no @gol
-mspe -mno-spe @gol -mspe -mno-spe @gol
-mspe=yes -mspe=no @gol -mspe=yes -mspe=no @gol
-mpaired @gol
-mvrsave -mno-vrsave @gol -mvrsave -mno-vrsave @gol
-mmulhw -mno-mulhw @gol -mmulhw -mno-mulhw @gol
-mdlmzb -mno-dlmzb @gol -mdlmzb -mno-dlmzb @gol
...@@ -12582,6 +12583,13 @@ This switch has been deprecated. Use @option{-misel} and ...@@ -12582,6 +12583,13 @@ This switch has been deprecated. Use @option{-misel} and
This switch enables or disables the generation of SPE simd This switch enables or disables the generation of SPE simd
instructions. instructions.
@item -mpaired
@itemx -mno-paired
@opindex mpaired
@opindex mno-paired
This switch enables or disables the generation of PAIRED simd
instructions.
@item -mspe=@var{yes/no} @item -mspe=@var{yes/no}
This option has been deprecated. Use @option{-mspe} and This option has been deprecated. Use @option{-mspe} and
@option{-mno-spe} instead. @option{-mno-spe} instead.
......
2007-08-31 David Edelsohn <edelsohn@gnu.org>
Revital Eres <eres@il.ibm.com>
* gcc.target/powerpc/paired-1.c: New test.
* gcc.target/powerpc/paired-2.c: New test.
* gcc.target/powerpc/paired-3.c: New test.
* gcc.target/powerpc/paired-4.c: New test.
* gcc.target/powerpc/paired-5.c: New test.
* gcc.target/powerpc/paired-6.c: New test.
* gcc.target/powerpc/paired-7.c: New test.
* gcc.target/powerpc/ppc-paired.c: New test.
2007-08-30 Ollie Wild <aaw@google.com> 2007-08-30 Ollie Wild <aaw@google.com>
g++.dg/conversion/ptrmem2.C: New test. g++.dg/conversion/ptrmem2.C: New test.
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only " } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
static float in1[2] __attribute__ ((aligned (8))) =
{6.0, 7.0};
static float in2[2] __attribute__ ((aligned (8))) =
{4.0, 3.0};
static float out[2] __attribute__ ((aligned (8)));
vector float a, b, c, d;
void
test_api ()
{
b = paired_lx (0, in1);
c = paired_lx (0, in2);
a = paired_sub (b, c);
paired_stx (a, 0, out);
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 3.0, 8.0 };
vector float c = { 3.0, 5.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu0_eq (b, c))
{
a = paired_sub (b, c);
paired_stx (a, 0, out);
}
if ((out[1]) != 3.0)
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 2.0, 8.0 };
vector float c = { 3.0, 5.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu0_lt (b, c))
{
a = paired_add (b, c);
paired_stx (a, 0, out);
}
if ((out[0] != 5.0) || (out[1] != 13.0))
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 3.0, 8.0 };
vector float c = { 2.0, 5.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu0_gt (b, c))
{
a = paired_add (b, c);
paired_stx (a, 0, out);
}
if ((out[0] != 5.0) || (out[1] != 13.0))
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 3.0, 5.0 };
vector float c = { 2.0, 5.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu1_eq (b, c))
{
a = paired_add (b, c);
paired_stx (a, 0, out);
}
if ((out[0] != 5.0) || (out[1] != 10.0))
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 3.0, 5.0 };
vector float c = { 2.0, 6.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu1_lt (b, c))
{
a = paired_add (b, c);
paired_stx (a, 0, out);
}
if ((out[0] != 5.0) || (out[1] != 11.0))
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
#include <stdlib.h>
static float out[2] __attribute__ ((aligned (8)));
vector float b = { 2.0, 8.0 };
vector float c = { 3.0, 6.0 };
vector float a = { 0.0, 0.0 };
void
test_api ()
{
if (paired_cmpu1_gt (b, c))
{
a = paired_add (b, c);
paired_stx (a, 0, out);
}
if ((out[0] != 5.0) || (out[1] != 14.0))
abort ();
}
int
main ()
{
test_api ();
return (0);
}
/* { dg-do compile { target powerpc-*-linux*paired* } } */
/* { dg-options "-mpaired -m32 -ffinite-math-only" } */
/* Test PowerPC PAIRED extensions. */
#include <paired.h>
vector float a, b, c, d;
void
test_api ()
{
b = paired_msub (b, c, d);
b = paired_madd (b, c, d);
b = paired_nmadd (b, c, d);
b = paired_nmsub (b, c, d);
b = paired_sum0 (a, b, c);
b = paired_sum1 (a, b, c);
b = paired_div (b, c);
b = paired_add (a, c);
b = paired_sub (a, c);
b = paired_mul (a, c);
b = paired_neg (a);
b = paired_muls0 (a, c);
b = paired_muls1 (a, c);
b = paired_madds0 (a, c, d);
b = paired_madds1 (a, c, d);
b = paired_merge00 (a, c);
b = paired_merge01 (a, c);
b = paired_merge10 (a, c);
b = paired_merge11 (a, c);
b = paired_abs (a);
b = paired_nabs (a);
b = paired_sqrt (a);
b = paired_res (a);
}
int
main (void)
{
test_api ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment