OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-src/gcc-4.2.2/gcc/testsuite/gcc.target/mips
    from Rev 149 to Rev 154
    Reverse comparison

Rev 149 → Rev 154

/fpcmp-1.c
0,0 → 1,6
/* We used to use c.lt.fmt instead of c.ule.fmt here. */
/* { dg-mips-options "-mhard-float -O2" } */
int f1 (float x, float y) { return __builtin_isless (x, y); }
int f2 (double x, double y) { return __builtin_isless (x, y); }
/* { dg-final { scan-assembler "c\\.ule\\.s" } } */
/* { dg-final { scan-assembler "c\\.ule\\.d" } } */
fpcmp-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vr-mult-1.c =================================================================== --- vr-mult-1.c (nonexistent) +++ vr-mult-1.c (revision 154) @@ -0,0 +1,7 @@ +/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu + is preferred over mtlo/msac. */ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -march=vr5400" } */ +int f1 (int a, int b, int c) { return a + b * c; } +int f2 (int a, int b, int c) { return a - b * c; } +/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */
vr-mult-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fpcmp-2.c =================================================================== --- fpcmp-2.c (nonexistent) +++ fpcmp-2.c (revision 154) @@ -0,0 +1,6 @@ +/* We used to use c.le.fmt instead of c.ult.fmt here. */ +/* { dg-mips-options "-mhard-float -O2" } */ +int f1 (float x, float y) { return __builtin_islessequal (x, y); } +int f2 (double x, double y) { return __builtin_islessequal (x, y); } +/* { dg-final { scan-assembler "c\\.ult\\.s" } } */ +/* { dg-final { scan-assembler "c\\.ult\\.d" } } */
fpcmp-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vr-mult-2.c =================================================================== --- vr-mult-2.c (nonexistent) +++ vr-mult-2.c (revision 154) @@ -0,0 +1,7 @@ +/* Make sure that mul/addu is preferred over mtlo/macc and that mul/subu + is preferred over mtlo/msac. */ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -march=vr5500" } */ +int f1 (int a, int b, int c) { return a + b * c; } +int f2 (int a, int b, int c) { return a - b * c; } +/* { dg-final { scan-assembler "\tmul\t.*\tmul\t" } } */
vr-mult-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips32-dsp-type.c =================================================================== --- mips32-dsp-type.c (nonexistent) +++ mips32-dsp-type.c (revision 154) @@ -0,0 +1,30 @@ +/* Test MIPS32 DSP instructions */ +/* { dg-do compile } */ +/* { dg-mips-options "-march=mips32 -mdsp" } */ +/* { dg-final { scan-assembler "addq.ph" } } */ +/* { dg-final { scan-assembler "addu.qb" } } */ +/* { dg-final { scan-assembler "subq.ph" } } */ +/* { dg-final { scan-assembler "subu.qb" } } */ + +typedef char v4qi __attribute__ ((vector_size(4))); +typedef short v2hi __attribute__ ((vector_size(4))); + +v2hi add_v2hi (v2hi a, v2hi b) +{ + return a + b; +} + +v4qi add_v4qi (v4qi a, v4qi b) +{ + return a + b; +} + +v2hi sub_v2hi (v2hi a, v2hi b) +{ + return a - b; +} + +v4qi sub_v4qi (v4qi a, v4qi b) +{ + return a - b; +}
mips32-dsp-type.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fix-vr4130-1.c =================================================================== --- fix-vr4130-1.c (nonexistent) +++ fix-vr4130-1.c (revision 154) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */ +int foo (void) { int r; asm ("# foo" : "=h" (r)); return r; } +/* { dg-final { scan-assembler "\tmacchi\t" } } */
fix-vr4130-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips.exp =================================================================== --- mips.exp (nonexistent) +++ mips.exp (revision 154) @@ -0,0 +1,198 @@ +# Copyright (C) 1997, 2007 Free Software Foundation, Inc. + +# This program 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 3 of the License, or +# (at your option) any later version. +# +# This program 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 COPYING3. If not see +# . + +# GCC testsuite that uses the `dg.exp' driver. + +# Exit immediately if this isn't a MIPS target. +if ![istarget mips*-*-*] { + return +} + +# Load support procs. +load_lib gcc-dg.exp + +# Find out which target is selected by the default compiler flags. +# Also remember which aspects of the target are forced on the command +# line (as opposed to being overridable defaults). +# +# $mips_isa: the ISA level specified by __mips +# $mips_arch: the architecture specified by _MIPS_ARCH +# $mips_mips16: true if MIPS16 mode is selected +# $mips_mips64: true if 64-bit output is selected +# $mips_float: "hard" or "soft" +# +# $mips_forced_isa: true if the command line uses -march=* or -mips* +# $mips_forced_abi: true if the command line uses -mabi=* or -mgp* +# $mips_forced_float: true if the command line uses -mhard/soft-float +# $mips_forced_le true if the command line uses -EL or -mel +proc setup_mips_tests {} { + global mips_isa + global mips_arch + global mips_mips16 + global mips_mips64 + global mips_float + + global mips_forced_isa + global mips_forced_abi + global mips_forced_float + global mips_forced_le + + global compiler_flags + global tool + + set src dummy[pid].c + set f [open $src "w"] + puts $f { + int isa = __mips; + const char *arch = _MIPS_ARCH; + #ifdef __mips16 + int mips16 = 1; + #endif + #ifdef __mips64 + int mips64 = 1; + #endif + #ifdef __mips_hard_float + const char *float = "hard"; + #else + const char *float = "soft"; + #endif + } + close $f + set output [${tool}_target_compile $src "" preprocess ""] + file delete $src + + regexp {isa = ([^;]*)} $output dummy mips_isa + regexp {arch = "([^"]*)} $output dummy mips_arch + set mips_mips16 [regexp {mips16 = 1} $output] + set mips_mips64 [regexp {mips64 = 1} $output] + regexp {float = "([^"]*)} $output dummy mips_float + + set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags] + set mips_forced_abi [regexp -- {(-mgp|-mabi)} $compiler_flags] + set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags] + set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags] +} + +# Return true if command-line option FLAG forces 32-bit code. +proc is_gp32_flag {flag} { + switch -glob -- $flag { + -march=mips32* - + -mgp32 { return 1 } + default { return 0 } + } +} + +# Like dg-options, but treats certain MIPS-specific options specially: +# +# -mgp32 +# -march=mips32* +# Force 32-bit code. Skip the test if the multilib flags force +# a 64-bit ABI. +# +# -mgp64 +# Force 64-bit code. Also force a 64-bit target architecture +# if the other flags don't do so. Skip the test if the multilib +# flags force a 32-bit ABI or a 32-bit architecture. +# +# -mno-mips16 +# Skip the test for MIPS16 targets. +# +# -march=* +# -mips* +# Select the target architecture. Skip the test for MIPS16 targets +# or if the multilib flags force a different architecture. +# +# -msoft-float +# -mhard-float +# Select the given floating-point mode. Skip the test if the +# multilib flags force a different selection. +# +# -EB +# Select big-endian code. Skip the test if the multilib flags +# force a little-endian target. +proc dg-mips-options {args} { + upvar dg-extra-tool-flags extra_tool_flags + upvar dg-do-what do_what + + global mips_isa + global mips_arch + global mips_mips16 + global mips_mips64 + global mips_float + + global mips_forced_isa + global mips_forced_abi + global mips_forced_float + global mips_forced_le + + set flags [lindex $args 1] + set matches 1 + + # First handle the -mgp* options. Add an architecture option if necessary. + foreach flag $flags { + if {[is_gp32_flag $flag] && $mips_mips64} { + if {$mips_forced_abi} { + set matches 0 + } else { + append flags " -mabi=32" + } + } elseif {$flag == "-mgp64" && !$mips_mips64} { + if {$mips_forced_abi} { + set matches 0 + } else { + append flags " -mabi=o64" + if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} { + append flags " -mips3" + } + } + } + } + # Handle the other options. + foreach flag $flags { + if {$flag == "-mno-mips16"} { + if {$mips_mips16} { + set matches 0 + } + } elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} { + if {$mips_mips16 || ($arch != $mips_arch && $mips_forced_isa)} { + set matches 0 + } + } elseif {[regexp -- {^-mips(.*)} $flag dummy isa] && $isa != 16} { + if {$mips_mips16 || ($isa != $mips_isa && $mips_forced_isa)} { + set matches 0 + } + } elseif {[regexp -- {^-m(hard|soft)-float} $flag dummy float]} { + if {$mips_float != $float && $mips_forced_float} { + set matches 0 + } + } elseif {[regexp -- {^-(EB|meb)$} $flag]} { + if {$mips_forced_le} { + set matches 0 + } + } + } + if {$matches} { + set extra_tool_flags $flags + } else { + set do_what [list [lindex $do_what 0] "N" "P"] + } +} + +setup_mips_tests + +dg-init +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" "" +dg-finish Index: fix-vr4130-2.c =================================================================== --- fix-vr4130-2.c (nonexistent) +++ fix-vr4130-2.c (revision 154) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-march=vr4130 -mfix-vr4130" } */ +int foo (void) { int r; asm ("# foo" : "=l" (r)); return r; } +/* { dg-final { scan-assembler "\tmacc\t" } } */
fix-vr4130-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: sb1-1.c =================================================================== --- sb1-1.c (nonexistent) +++ sb1-1.c (revision 154) @@ -0,0 +1,29 @@ +/* Test SB-1 v2sf extensions. */ +/* { dg-do compile } */ +/* { dg-mips-options "-march=sb1 -O2 -mpaired-single -mhard-float -mgp64 -ffast-math" } */ +/* { dg-final { scan-assembler "div.ps" } } */ +/* { dg-final { scan-assembler "recip.ps" } } */ +/* { dg-final { scan-assembler "sqrt.ps" } } */ +/* { dg-final { scan-assembler "rsqrt.ps" } } */ + +typedef float v2sf __attribute__ ((vector_size (8))); + +v2sf divide (v2sf a, v2sf b) +{ + return a / b; +} + +v2sf recip (v2sf a) +{ + return ((v2sf) {1.0, 1.0}) / a; +} + +v2sf squareroot (v2sf a) +{ + return __builtin_mips_sqrt_ps (a); +} + +v2sf rsqrt (v2sf a) +{ + return ((v2sf) {1.0, 1.0}) / __builtin_mips_sqrt_ps (a); +}
sb1-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fix-vr4130-3.c =================================================================== --- fix-vr4130-3.c (nonexistent) +++ fix-vr4130-3.c (revision 154) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */ +long long foo (void) { long long r; asm ("# foo" : "=h" (r)); return r; } +/* { dg-final { scan-assembler "\tdmacchi\t" } } */
fix-vr4130-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: fix-vr4130-4.c =================================================================== --- fix-vr4130-4.c (nonexistent) +++ fix-vr4130-4.c (revision 154) @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-march=vr4130 -mgp64 -mfix-vr4130" } */ +long long foo (void) { long long r; asm ("# foo" : "=l" (r)); return r; } +/* { dg-final { scan-assembler "\tdmacc\t" } } */
fix-vr4130-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-1.c =================================================================== --- mips-ps-1.c (nonexistent) +++ mips-ps-1.c (revision 154) @@ -0,0 +1,271 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */ + +/* Test v2sf calculations */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size (8))); + +v2sf A = {100, 200}; + +/* Init from float */ +v2sf init (float a, float b) +{ + return (v2sf) {a, b}; +} + +/* Move between registers */ +v2sf move (v2sf a) +{ + return a; +} + +/* Load from memory */ +v2sf load () +{ + return A; +} + +/* Store to memory */ +void store (v2sf a) +{ + A = a; +} + +/* Add */ +v2sf add (v2sf a, v2sf b) +{ + return a + b; +} + +/* Subtract */ +v2sf sub (v2sf a, v2sf b) +{ + return a - b; +} + +/* Negate */ +v2sf neg (v2sf a) +{ + return - a; +} + +/* Multiply */ +v2sf mul (v2sf a, v2sf b) +{ + return a * b; +} + +/* Multiply and add */ +v2sf madd (v2sf a, v2sf b, v2sf c) +{ + return a * b + c; +} + +/* Multiply and subtract */ +v2sf msub (v2sf a, v2sf b, v2sf c) +{ + return a * b - c; +} + +/* Negate Multiply and add */ +v2sf nmadd (v2sf a, v2sf b, v2sf c) +{ + return - (a * b + c); +} + +/* Negate Multiply and subtract */ +v2sf nmsub (v2sf a, v2sf b, v2sf c) +{ + return - (a * b - c); +} + +/* Conditional Move */ +v2sf cond_move1 (v2sf a, v2sf b, long i) +{ + if (i > 0) + return a; + else + return b; +} + +/* Conditional Move */ +v2sf cond_move2 (v2sf a, v2sf b, int i) +{ + if (i > 0) + return a; + else + return b; +} + +/* Conditional Move */ +v2sf cond_move3 (v2sf a, v2sf b, float i) +{ + if (i > 0.0) + return a; + else + return b; +} + +/* Conditional Move */ +v2sf cond_move4 (v2sf a, v2sf b, double i) +{ + if (i > 0.0) + return a; + else + return b; +} + +int main() +{ + v2sf a, b, c, d, e, f; + float f1, f2; + + f1 = 1.2; + f2 = 3.4; + a = init (f1, f2); + b = (v2sf) {1.2, 3.4}; + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + a = (v2sf) {1.2, 2.3}; + b = (v2sf) {5.3, 6.1}; + b = move (a); + + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + a = (v2sf) {1.2, 2.3}; + b = (v2sf) {5.3, 6.1}; + c = add (a, b); + d = (v2sf) {6.5, 8.4}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = sub (a, b); + d = (v2sf) {-4, 6}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = mul (a, b); + d = (v2sf) {5, 72}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {5, 6}; + d = madd (a, b, c); + e = (v2sf) {10, 78}; + if (!__builtin_mips_upper_c_eq_ps (d, e) || + !__builtin_mips_lower_c_eq_ps (d, e)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {5, 6}; + d = msub (a, b, c); + e = (v2sf) {0, 66}; + if (!__builtin_mips_upper_c_eq_ps (d, e) || + !__builtin_mips_lower_c_eq_ps (d, e)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {5, 6}; + d = nmadd (a, b, c); + e = (v2sf) {-10, -78}; + if (!__builtin_mips_upper_c_eq_ps (d, e) || + !__builtin_mips_lower_c_eq_ps (d, e)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {5, 6}; + d = nmsub (a, b, c); + e = (v2sf) {0, -66}; + if (!__builtin_mips_upper_c_eq_ps (d, e) || + !__builtin_mips_lower_c_eq_ps (d, e)) + abort (); + + a = (v2sf) {98, 12}; + b = neg (a); + c = (v2sf) {-98, -12}; + if (!__builtin_mips_upper_c_eq_ps (b, c) || + !__builtin_mips_lower_c_eq_ps (b, c)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = cond_move1 (a, b, 1000); + if (!__builtin_mips_upper_c_eq_ps (c, a) || + !__builtin_mips_lower_c_eq_ps (c, a)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = cond_move2 (a, b, -1000); + if (!__builtin_mips_upper_c_eq_ps (c, b) || + !__builtin_mips_lower_c_eq_ps (c, b)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = cond_move3 (a, b, 9.0); + if (!__builtin_mips_upper_c_eq_ps (c, a) || + !__builtin_mips_lower_c_eq_ps (c, a)) + abort (); + + a = (v2sf) {1, 12}; + b = (v2sf) {5, 6}; + c = cond_move4 (a, b, -10.0); + if (!__builtin_mips_upper_c_eq_ps (c, b) || + !__builtin_mips_lower_c_eq_ps (c, b)) + abort (); + + a = (v2sf) {5, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_c_eq_ps (a, b, c, d); + f = (v2sf) {8, 123}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + a = (v2sf) {5, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movf_c_eq_ps (a, b, c, d); + f = (v2sf) {33, 78}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + a = load(); + b = (v2sf) {100, 200}; + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + a = (v2sf) {123, 321}; + store (a); + b = load(); + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + printf ("Test Passes\n"); + exit (0); +}
mips-ps-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-2.c =================================================================== --- mips-ps-2.c (nonexistent) +++ mips-ps-2.c (revision 154) @@ -0,0 +1,134 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */ + +/* Test MIPS paired-single builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int main () +{ + int little_endian; + v2sf a, b, c, d; + float e,f; + int i; + + union { long long ll; int i[2]; } endianness_test; + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + /* pll.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_pll_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {3, 1}; + else // big endian + d = (v2sf) {2, 4}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* pul.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_pul_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {3, 2}; + else // big endian + d = (v2sf) {1, 4}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* plu.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_plu_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {4, 1}; + else // big endian + d = (v2sf) {2, 3}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* puu.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_puu_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {4, 2}; + else // big endian + d = (v2sf) {1, 3}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* cvt.ps.s */ + e = 3.4; + f = 4.5; + a = __builtin_mips_cvt_ps_s (e, f); + if (little_endian) // little endian + b = (v2sf) {4.5, 3.4}; + else // big endian + b = (v2sf) {3.4, 4.5}; + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + /* cvt.s.pl */ + a = (v2sf) {35.1, 120.2}; + e = __builtin_mips_cvt_s_pl (a); + if (little_endian) // little endian + f = 35.1; + else // big endian + f = 120.2; + if (e != f) + abort (); + + /* cvt.s.pu */ + a = (v2sf) {30.0, 100.0}; + e = __builtin_mips_cvt_s_pu (a); + if (little_endian) // little endian + f = 100.0; + else // big endian + f = 30.0; + if (e != f) + abort (); + + /* abs.ps */ + a = (v2sf) {-3.4, -5.8}; + b = __builtin_mips_abs_ps (a); + c = (v2sf) {3.4, 5.8}; + if (!__builtin_mips_upper_c_eq_ps (b, c) || + !__builtin_mips_lower_c_eq_ps (b, c)) + abort (); + + /* alnv.ps with rs = 4*/ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + i = 4; + c = __builtin_mips_alnv_ps (a, b, i); + d = (v2sf) {2, 3}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* alnv.ps with rs = 0 */ + a = (v2sf) {5, 6}; + b = (v2sf) {7, 8}; + i = 0; + c = __builtin_mips_alnv_ps (a, b, i); + d = (v2sf) {5, 6}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + printf ("Test Passes\n"); + exit (0); +}
mips-ps-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-3.c =================================================================== --- mips-ps-3.c (nonexistent) +++ mips-ps-3.c (revision 154) @@ -0,0 +1,737 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */ + +/* Test MIPS paired-single conditional move */ +#include +#include + +typedef float v2sf __attribute__((vector_size(8))); + +v2sf test0 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test1 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test2 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test3 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test4 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test5 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test6 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test7 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test8 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test9 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test10 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test11 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test12 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test13 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test14 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test15 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test16 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test17 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test18 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test19 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test20 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test21 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test22 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test23 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test24 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test25 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test26 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test27 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test28 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test29 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test30 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test31 (v2sf a, v2sf b, v2sf c, v2sf d); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + float f1; + v2sf a, b, c, d, e, f; + + /* Case 1 {diff, diff} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {9, 6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_c_eq_ps (a, b, c, d); + f = (v2sf) {33, 123}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_c_eq_ps (a, b, c, d); + f = (v2sf) {8, 78}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* Case 2 {same, diff} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {5, 6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_c_eq_ps (a, b, c, d); + f = (v2sf) {8, 123}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_c_eq_ps (a, b, c, d); + f = (v2sf) {33, 78}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* Case 3 {diff, same} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {9, 12}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_c_eq_ps (a, b, c, d); + f = (v2sf) {33, 78}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_c_eq_ps (a, b, c, d); + f = (v2sf) {8, 123}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* Case 4 {same, same} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {5, 12}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_c_eq_ps (a, b, c, d); + f = (v2sf) {8, 78}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_c_eq_ps (a, b, c, d); + f = (v2sf) {33, 123}; + if (!__builtin_mips_upper_c_eq_ps (e, f) || + !__builtin_mips_lower_c_eq_ps (e, f)) + abort (); + + /* Test all 16 operators */ + a = (v2sf) {123, 123}; + b = (v2sf) {1000, 1000}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = test0 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test1 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test2 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test3 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test4 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test5 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test6 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test7 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test8 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test9 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test10 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test11 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test12 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test13 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test14 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test15 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test16 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test17 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test18 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test19 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test20 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test21 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test22 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test23 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test24 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test25 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test26 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test27 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test28 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test29 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test30 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test31 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + /* Test all 16 operators with (b, a) */ + a = (v2sf) {123, 123}; + b = (v2sf) {1000, 1000}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = test0 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test1 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test2 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test3 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test4 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test5 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test6 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test7 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test8 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test9 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test10 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test11 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test12 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test13 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test14 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test15 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test16 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test17 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test18 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test19 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test20 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test21 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test22 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test23 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test24 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test25 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test26 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test27 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test28 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test29 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test30 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test31 (b, a, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + +#ifndef __FAST_MATH__ + /* Test with NaN */ + a = (v2sf) {qnan, qnan}; + b = (v2sf) {1000, 1000}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = test0 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test1 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test2 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test3 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test4 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test5 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test6 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test7 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test8 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test9 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test10 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test11 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test12 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test13 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test14 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test15 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test16 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test17 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test18 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test19 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test20 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test21 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test22 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test23 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test24 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test25 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test26 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test27 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + + e = test28 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); + e = test29 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + + e = test30 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, d) || + !__builtin_mips_lower_c_eq_ps (e, d)) + abort (); + e = test31 (a, b, c, d); + if (!__builtin_mips_upper_c_eq_ps (e, c) || + !__builtin_mips_lower_c_eq_ps (e, c)) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +v2sf test0 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_f_ps (a, b, c, d); +} + +v2sf test1 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_f_ps (a, b, c, d); +} + +v2sf test2 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_un_ps (a, b, c, d); +} + +v2sf test3 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_un_ps (a, b, c, d); +} + +v2sf test4 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_eq_ps (a, b, c, d); +} + +v2sf test5 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_eq_ps (a, b, c, d); +} + +v2sf test6 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ueq_ps (a, b, c, d); +} + +v2sf test7 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ueq_ps (a, b, c, d); +} + +v2sf test8 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_olt_ps (a, b, c, d); +} + +v2sf test9 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_olt_ps (a, b, c, d); +} + +v2sf test10 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ult_ps (a, b, c, d); +} + +v2sf test11 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ult_ps (a, b, c, d); +} + +v2sf test12 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ole_ps (a, b, c, d); +} + +v2sf test13 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ole_ps (a, b, c, d); +} + +v2sf test14 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ule_ps (a, b, c, d); +} + +v2sf test15 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ule_ps (a, b, c, d); +} + +v2sf test16 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_sf_ps (a, b, c, d); +} + +v2sf test17 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_sf_ps (a, b, c, d); +} + +v2sf test18 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ngle_ps (a, b, c, d); +} + +v2sf test19 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ngle_ps (a, b, c, d); +} + +v2sf test20 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_seq_ps (a, b, c, d); +} + +v2sf test21 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_seq_ps (a, b, c, d); +} + +v2sf test22 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ngl_ps (a, b, c, d); +} + +v2sf test23 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ngl_ps (a, b, c, d); +} + +v2sf test24 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_lt_ps (a, b, c, d); +} + +v2sf test25 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_lt_ps (a, b, c, d); +} + +v2sf test26 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_nge_ps (a, b, c, d); +} + +v2sf test27 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_nge_ps (a, b, c, d); +} + +v2sf test28 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_le_ps (a, b, c, d); +} + +v2sf test29 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_le_ps (a, b, c, d); +} + +v2sf test30 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_c_ngt_ps (a, b, c, d); +} + +v2sf test31 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_c_ngt_ps (a, b, c, d); +}
mips-ps-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: memcpy-1.c =================================================================== --- memcpy-1.c (nonexistent) +++ memcpy-1.c (revision 154) @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2" } */ +/* { dg-final { scan-assembler-not "\tlbu\t" } } */ + +#include + +char c[10]; + +void +f1 () +{ + memcpy (c, "123456", 6); +} + +void +f2 () +{ + memcpy (c, &"12345678"[2], 6); +}
memcpy-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-4.c =================================================================== --- mips-ps-4.c (nonexistent) +++ mips-ps-4.c (revision 154) @@ -0,0 +1,583 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64" } */ + +/* Test MIPS paired-single comparisons */ +#include +#include + +typedef float v2sf __attribute__((vector_size(8))); + +int test0 (v2sf a, v2sf b); +int test1 (v2sf a, v2sf b); +int test2 (v2sf a, v2sf b); +int test3 (v2sf a, v2sf b); +int test4 (v2sf a, v2sf b); +int test5 (v2sf a, v2sf b); +int test6 (v2sf a, v2sf b); +int test7 (v2sf a, v2sf b); +int test8 (v2sf a, v2sf b); +int test9 (v2sf a, v2sf b); +int test10 (v2sf a, v2sf b); +int test11 (v2sf a, v2sf b); +int test12 (v2sf a, v2sf b); +int test13 (v2sf a, v2sf b); +int test14 (v2sf a, v2sf b); +int test15 (v2sf a, v2sf b); +int test16 (v2sf a, v2sf b); +int test17 (v2sf a, v2sf b); +int test18 (v2sf a, v2sf b); +int test19 (v2sf a, v2sf b); +int test20 (v2sf a, v2sf b); +int test21 (v2sf a, v2sf b); +int test22 (v2sf a, v2sf b); +int test23 (v2sf a, v2sf b); +int test24 (v2sf a, v2sf b); +int test25 (v2sf a, v2sf b); +int test26 (v2sf a, v2sf b); +int test27 (v2sf a, v2sf b); +int test28 (v2sf a, v2sf b); +int test29 (v2sf a, v2sf b); +int test30 (v2sf a, v2sf b); +int test31 (v2sf a, v2sf b); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main() +{ + union { long long ll; int i[2]; } endianness_test; + int little_endian; + v2sf a, b; + int i, j; + + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + /* Case 1 {diff, diff} */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + i = __builtin_mips_upper_c_eq_ps (a, b); + j = __builtin_mips_lower_c_eq_ps (a, b); + if (i != 0 || j != 0) + abort (); + + /* Case 2 {same, diff} */ + a = (v2sf) {1.0, 2.0}; + b = (v2sf) {1.0, 4.0}; + i = __builtin_mips_upper_c_eq_ps (a, b); + j = __builtin_mips_lower_c_eq_ps (a, b); + if (little_endian) + { + if (i != 0 || j != 1) + abort (); + } + else + { + if (i != 1 || j != 0) + abort (); + } + + /* Case 3 {diff, same} */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 2}; + i = __builtin_mips_upper_c_eq_ps (a, b); + j = __builtin_mips_lower_c_eq_ps (a, b); + if (little_endian) + { + if (i != 1 || j != 0) + abort (); + } + else + { + if (i != 0 || j != 1) + abort (); + } + + /* Case 4 {same, same} */ + a = (v2sf) {1, 2}; + b = (v2sf) {1, 2}; + i = __builtin_mips_upper_c_eq_ps (a, b); + j = __builtin_mips_lower_c_eq_ps (a, b); + if (i != 1 || j != 1) + abort (); + + /* Test upper/lower with 16 operators */ + if (little_endian) + { + a = (v2sf) {1984.0, 10.58}; + b = (v2sf) {1984.0, 567.345}; + } + else + { + a = (v2sf) {10.58, 1984.0}; + b = (v2sf) {567.345, 1984.0}; + } + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 0) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 1) + abort (); + i = test6 (a, b); + if (i != 0) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 1) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 0) + abort (); + i = test12 (a, b); + if (i != 1) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + i = test16 (a, b); + if (i != 0) + abort (); + i = test17 (a, b); + if (i != 0) + abort (); + i = test18 (a, b); + if (i != 0) + abort (); + i = test19 (a, b); + if (i != 0) + abort (); + i = test20 (a, b); + if (i != 0) + abort (); + i = test21 (a, b); + if (i != 1) + abort (); + i = test22 (a, b); + if (i != 0) + abort (); + i = test23 (a, b); + if (i != 1) + abort (); + i = test24 (a, b); + if (i != 1) + abort (); + i = test25 (a, b); + if (i != 0) + abort (); + i = test26 (a, b); + if (i != 1) + abort (); + i = test27 (a, b); + if (i != 0) + abort (); + i = test28 (a, b); + if (i != 1) + abort (); + i = test29 (a, b); + if (i != 1) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); + + /* Reverse arguments */ + i = test0 (b, a); + if (i != 0) + abort (); + i = test1 (b, a); + if (i != 0) + abort (); + i = test2 (b, a); + if (i != 0) + abort (); + i = test3 (b, a); + if (i != 0) + abort (); + i = test4 (b, a); + if (i != 0) + abort (); + i = test5 (b, a); + if (i != 1) + abort (); + i = test6 (b, a); + if (i != 0) + abort (); + i = test7 (b, a); + if (i != 1) + abort (); + i = test8 (b, a); + if (i != 0) + abort (); + i = test9 (b, a); + if (i != 0) + abort (); + i = test10 (b, a); + if (i != 0) + abort (); + i = test11 (b, a); + if (i != 0) + abort (); + i = test12 (b, a); + if (i != 0) + abort (); + i = test13 (b, a); + if (i != 1) + abort (); + i = test14 (b, a); + if (i != 0) + abort (); + i = test15 (b, a); + if (i != 1) + abort (); + i = test16 (b, a); + if (i != 0) + abort (); + i = test17 (b, a); + if (i != 0) + abort (); + i = test18 (b, a); + if (i != 0) + abort (); + i = test19 (b, a); + if (i != 0) + abort (); + i = test20 (b, a); + if (i != 0) + abort (); + i = test21 (b, a); + if (i != 1) + abort (); + i = test22 (b, a); + if (i != 0) + abort (); + i = test23 (b, a); + if (i != 1) + abort (); + i = test24 (b, a); + if (i != 0) + abort (); + i = test25 (b, a); + if (i != 0) + abort (); + i = test26 (b, a); + if (i != 0) + abort (); + i = test27 (b, a); + if (i != 0) + abort (); + i = test28 (b, a); + if (i != 0) + abort (); + i = test29 (b, a); + if (i != 1) + abort (); + i = test30 (b, a); + if (i != 0) + abort (); + i = test31 (b, a); + if (i != 1) + abort (); + +#ifndef __FAST_MATH__ + /* Test upper/lower with 16 operators */ + if (little_endian) + { + a = (v2sf) {qnan, qnan}; + b = (v2sf) {1984.0, 567.345}; + } + else + { + a = (v2sf) {qnan, qnan}; + b = (v2sf) {567.345, 1984.0}; + } + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 1) + abort (); + i = test3 (a, b); + if (i != 1) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 0) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 1) + abort (); + i = test12 (a, b); + if (i != 0) + abort (); + i = test13 (a, b); + if (i != 0) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + i = test16 (a, b); + if (i != 0) + abort (); + i = test17 (a, b); + if (i != 0) + abort (); + i = test18 (a, b); + if (i != 1) + abort (); + i = test19 (a, b); + if (i != 1) + abort (); + i = test20 (a, b); + if (i != 0) + abort (); + i = test21 (a, b); + if (i != 0) + abort (); + i = test22 (a, b); + if (i != 1) + abort (); + i = test23 (a, b); + if (i != 1) + abort (); + i = test24 (a, b); + if (i != 0) + abort (); + i = test25 (a, b); + if (i != 0) + abort (); + i = test26 (a, b); + if (i != 1) + abort (); + i = test27 (a, b); + if (i != 1) + abort (); + i = test28 (a, b); + if (i != 0) + abort (); + i = test29 (a, b); + if (i != 0) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_f_ps (a, b); +} + +int test1 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_f_ps (a, b); +} + +int test2 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_un_ps (a, b); +} + +int test3 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_un_ps (a, b); +} + +int test4 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_eq_ps (a, b); +} + +int test5 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_eq_ps (a, b); +} + +int test6 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ueq_ps (a, b); +} + +int test7 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ueq_ps (a, b); +} + +int test8 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_olt_ps (a, b); +} + +int test9 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_olt_ps (a, b); +} + +int test10 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ult_ps (a, b); +} + +int test11 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ult_ps (a, b); +} + +int test12 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ole_ps (a, b); +} + +int test13 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ole_ps (a, b); +} + +int test14 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ule_ps (a, b); +} + +int test15 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ule_ps (a, b); +} + +int test16 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_sf_ps (a, b); +} + +int test17 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_sf_ps (a, b); +} + +int test18 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ngle_ps (a, b); +} + +int test19 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ngle_ps (a, b); +} + +int test20 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_seq_ps (a, b); +} + +int test21 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_seq_ps (a, b); +} + +int test22 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ngl_ps (a, b); +} + +int test23 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ngl_ps (a, b); +} + +int test24 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_lt_ps (a, b); +} + +int test25 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_lt_ps (a, b); +} + +int test26 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_nge_ps (a, b); +} + +int test27 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_nge_ps (a, b); +} + +int test28 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_le_ps (a, b); +} + +int test29 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_le_ps (a, b); +} + +int test30 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_c_ngt_ps (a, b); +} + +int test31 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_c_ngt_ps (a, b); +}
mips-ps-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-5.c =================================================================== --- mips-ps-5.c (nonexistent) +++ mips-ps-5.c (revision 154) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64 -ftree-vectorize" } */ + +extern float a[], b[], c[]; + +void +foo (void) +{ + int i; + for (i = 0; i < 16; i++) + a[i] = b[i] == c[i] + 1 ? b[i] : c[i]; +} + +/* { dg-final { scan-assembler "add\\.ps" } } */ +/* { dg-final { scan-assembler "c\\.eq\\.ps" } } */ +/* { dg-final { scan-assembler "mov\[tf\]\\.ps" } } */
mips-ps-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-6.c =================================================================== --- mips-ps-6.c (nonexistent) +++ mips-ps-6.c (revision 154) @@ -0,0 +1,136 @@ +/* mips-ps-2.c with an extra -ffinite-math-only option. This option + changes the way that abs.ps is handled. */ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64 -ffinite-math-only" } */ + +/* Test MIPS paired-single builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int main () +{ + int little_endian; + v2sf a, b, c, d; + float e,f; + int i; + + union { long long ll; int i[2]; } endianness_test; + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + /* pll.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_pll_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {3, 1}; + else // big endian + d = (v2sf) {2, 4}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* pul.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_pul_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {3, 2}; + else // big endian + d = (v2sf) {1, 4}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* plu.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_plu_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {4, 1}; + else // big endian + d = (v2sf) {2, 3}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* puu.ps */ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + c = __builtin_mips_puu_ps (a, b); + if (little_endian) // little endian + d = (v2sf) {4, 2}; + else // big endian + d = (v2sf) {1, 3}; + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* cvt.ps.s */ + e = 3.4; + f = 4.5; + a = __builtin_mips_cvt_ps_s (e, f); + if (little_endian) // little endian + b = (v2sf) {4.5, 3.4}; + else // big endian + b = (v2sf) {3.4, 4.5}; + if (!__builtin_mips_upper_c_eq_ps (a, b) || + !__builtin_mips_lower_c_eq_ps (a, b)) + abort (); + + /* cvt.s.pl */ + a = (v2sf) {35.1, 120.2}; + e = __builtin_mips_cvt_s_pl (a); + if (little_endian) // little endian + f = 35.1; + else // big endian + f = 120.2; + if (e != f) + abort (); + + /* cvt.s.pu */ + a = (v2sf) {30.0, 100.0}; + e = __builtin_mips_cvt_s_pu (a); + if (little_endian) // little endian + f = 100.0; + else // big endian + f = 30.0; + if (e != f) + abort (); + + /* abs.ps */ + a = (v2sf) {-3.4, -5.8}; + b = __builtin_mips_abs_ps (a); + c = (v2sf) {3.4, 5.8}; + if (!__builtin_mips_upper_c_eq_ps (b, c) || + !__builtin_mips_lower_c_eq_ps (b, c)) + abort (); + + /* alnv.ps with rs = 4*/ + a = (v2sf) {1, 2}; + b = (v2sf) {3, 4}; + i = 4; + c = __builtin_mips_alnv_ps (a, b, i); + d = (v2sf) {2, 3}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + /* alnv.ps with rs = 0 */ + a = (v2sf) {5, 6}; + b = (v2sf) {7, 8}; + i = 0; + c = __builtin_mips_alnv_ps (a, b, i); + d = (v2sf) {5, 6}; + + if (!__builtin_mips_upper_c_eq_ps (c, d) || + !__builtin_mips_lower_c_eq_ps (c, d)) + abort (); + + printf ("Test Passes\n"); + exit (0); +}
mips-ps-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips32-dsp.c =================================================================== --- mips32-dsp.c (nonexistent) +++ mips32-dsp.c (revision 154) @@ -0,0 +1,1092 @@ +/* Test MIPS32 DSP instructions */ +/* { dg-do compile } */ +/* { dg-mips-options "-march=mips32 -mdsp" } */ +/* { dg-final { scan-assembler "addq.ph" } } */ +/* { dg-final { scan-assembler "addq_s.ph" } } */ +/* { dg-final { scan-assembler "addq_s.w" } } */ +/* { dg-final { scan-assembler "addu.qb" } } */ +/* { dg-final { scan-assembler "addu_s.qb" } } */ +/* { dg-final { scan-assembler "subq.ph" } } */ +/* { dg-final { scan-assembler "subq_s.ph" } } */ +/* { dg-final { scan-assembler "subq_s.w" } } */ +/* { dg-final { scan-assembler "subu.qb" } } */ +/* { dg-final { scan-assembler "subu_s.qb" } } */ +/* { dg-final { scan-assembler "addsc" } } */ +/* { dg-final { scan-assembler "addwc" } } */ +/* { dg-final { scan-assembler "modsub" } } */ +/* { dg-final { scan-assembler "raddu.w.qb" } } */ +/* { dg-final { scan-assembler "absq_s.ph" } } */ +/* { dg-final { scan-assembler "absq_s.w" } } */ +/* { dg-final { scan-assembler "precrq.qb.ph" } } */ +/* { dg-final { scan-assembler "precrq.ph.w" } } */ +/* { dg-final { scan-assembler "precrq_rs.ph.w" } } */ +/* { dg-final { scan-assembler "precrqu_s.qb.ph" } } */ +/* { dg-final { scan-assembler "preceq.w.phl" } } */ +/* { dg-final { scan-assembler "preceq.w.phr" } } */ +/* { dg-final { scan-assembler "precequ.ph.qbl" } } */ +/* { dg-final { scan-assembler "precequ.ph.qbr" } } */ +/* { dg-final { scan-assembler "precequ.ph.qbla" } } */ +/* { dg-final { scan-assembler "precequ.ph.qbra" } } */ +/* { dg-final { scan-assembler "preceu.ph.qbl" } } */ +/* { dg-final { scan-assembler "preceu.ph.qbr" } } */ +/* { dg-final { scan-assembler "preceu.ph.qbla" } } */ +/* { dg-final { scan-assembler "preceu.ph.qbra" } } */ +/* { dg-final { scan-assembler "shllv?.qb" } } */ +/* { dg-final { scan-assembler "shllv?.ph" } } */ +/* { dg-final { scan-assembler "shllv?_s.ph" } } */ +/* { dg-final { scan-assembler "shllv?_s.w" } } */ +/* { dg-final { scan-assembler "shrlv?.qb" } } */ +/* { dg-final { scan-assembler "shrav?.ph" } } */ +/* { dg-final { scan-assembler "shrav?_r.ph" } } */ +/* { dg-final { scan-assembler "shrav?_r.w" } } */ +/* { dg-final { scan-assembler "muleu_s.ph.qbl" } } */ +/* { dg-final { scan-assembler "muleu_s.ph.qbr" } } */ +/* { dg-final { scan-assembler "mulq_rs.ph" } } */ +/* { dg-final { scan-assembler "muleq_s.w.phl" } } */ +/* { dg-final { scan-assembler "muleq_s.w.phr" } } */ +/* { dg-final { scan-assembler "dpau.h.qbl" } } */ +/* { dg-final { scan-assembler "dpau.h.qbr" } } */ +/* { dg-final { scan-assembler "dpsu.h.qbl" } } */ +/* { dg-final { scan-assembler "dpsu.h.qbr" } } */ +/* { dg-final { scan-assembler "dpaq_s.w.ph" } } */ +/* { dg-final { scan-assembler "dpsq_s.w.ph" } } */ +/* { dg-final { scan-assembler "mulsaq_s.w.ph" } } */ +/* { dg-final { scan-assembler "dpaq_sa.l.w" } } */ +/* { dg-final { scan-assembler "dpsq_sa.l.w" } } */ +/* { dg-final { scan-assembler "maq_s.w.phl" } } */ +/* { dg-final { scan-assembler "maq_s.w.phr" } } */ +/* { dg-final { scan-assembler "maq_sa.w.phl" } } */ +/* { dg-final { scan-assembler "maq_sa.w.phr" } } */ +/* { dg-final { scan-assembler "bitrev" } } */ +/* { dg-final { scan-assembler "insv" } } */ +/* { dg-final { scan-assembler "replv?.qb" } } */ +/* { dg-final { scan-assembler "repl.ph" } } */ +/* { dg-final { scan-assembler "replv.ph" } } */ +/* { dg-final { scan-assembler "cmpu.eq.qb" } } */ +/* { dg-final { scan-assembler "cmpu.lt.qb" } } */ +/* { dg-final { scan-assembler "cmpu.le.qb" } } */ +/* { dg-final { scan-assembler "cmpgu.eq.qb" } } */ +/* { dg-final { scan-assembler "cmpgu.lt.qb" } } */ +/* { dg-final { scan-assembler "cmpgu.le.qb" } } */ +/* { dg-final { scan-assembler "cmp.eq.ph" } } */ +/* { dg-final { scan-assembler "cmp.lt.ph" } } */ +/* { dg-final { scan-assembler "cmp.le.ph" } } */ +/* { dg-final { scan-assembler "pick.qb" } } */ +/* { dg-final { scan-assembler "pick.ph" } } */ +/* { dg-final { scan-assembler "packrl.ph" } } */ +/* { dg-final { scan-assembler "extrv?.w" } } */ +/* { dg-final { scan-assembler "extrv?_s.h" } } */ +/* { dg-final { scan-assembler "extrv?_r.w" } } */ +/* { dg-final { scan-assembler "extrv?_rs.w" } } */ +/* { dg-final { scan-assembler "extpv?" } } */ +/* { dg-final { scan-assembler "extpdpv?" } } */ +/* { dg-final { scan-assembler "shilov?" } } */ +/* { dg-final { scan-assembler "mthlip" } } */ +/* { dg-final { scan-assembler "mfhi" } } */ +/* { dg-final { scan-assembler "mflo" } } */ +/* { dg-final { scan-assembler "mthi" } } */ +/* { dg-final { scan-assembler "mtlo" } } */ +/* { dg-final { scan-assembler "wrdsp" } } */ +/* { dg-final { scan-assembler "rddsp" } } */ +/* { dg-final { scan-assembler "lbux?" } } */ +/* { dg-final { scan-assembler "lhx?" } } */ +/* { dg-final { scan-assembler "lwx?" } } */ +/* { dg-final { scan-assembler "bposge32" } } */ + +#include +#include + +typedef char v4i8 __attribute__ ((vector_size(4))); +typedef short v2q15 __attribute__ ((vector_size(4))); + +typedef int q31; +typedef int i32; +typedef long long a64; + +void test_MIPS_DSP(); + +char array[100]; +int little_endian; + +int main() +{ + int i; + + union { long long ll; int i[2]; } endianness_test; + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + for (i = 0; i < 100; i++) + array[i] = i; + + test_MIPS_DSP(); + + exit (0); +} + +v2q15 add_v2q15 (v2q15 a, v2q15 b) +{ + return __builtin_mips_addq_ph (a, b); +} + +v4i8 add_v4i8 (v4i8 a, v4i8 b) +{ + return __builtin_mips_addu_qb (a, b); +} + +v2q15 sub_v2q15 (v2q15 a, v2q15 b) +{ + return __builtin_mips_subq_ph (a, b); +} + +v4i8 sub_v4i8 (v4i8 a, v4i8 b) +{ + return __builtin_mips_subu_qb (a, b); +} + +void test_MIPS_DSP() +{ + v4i8 v4i8_a,v4i8_b,v4i8_c,v4i8_r,v4i8_s; + v2q15 v2q15_a,v2q15_b,v2q15_c,v2q15_r,v2q15_s; + q31 q31_a,q31_b,q31_c,q31_r,q31_s; + i32 i32_a,i32_b,i32_c,i32_r,i32_s; + a64 a64_a,a64_b,a64_c,a64_r,a64_s; + + void *ptr_a; + int r,s; + long long lr,ls; + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + v2q15_s = (v2q15) {0x81bd, 0x6789}; + v2q15_r = add_v2q15 (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + v2q15_s = (v2q15) {0x7fff, 0x6789}; + v2q15_r = __builtin_mips_addq_s_ph (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = 0x70000000; + q31_b = 0x71234567; + q31_s = 0x7fffffff; + q31_r = __builtin_mips_addq_s_w (q31_a, q31_b); + if(q31_r != q31_s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0xff, 0x89, 0x11, 0x11}; + v4i8_s = (v4i8) {0xf1, 0xbd, 0x67, 0x89}; + v4i8_r = add_v4i8 (v4i8_a, v4i8_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0xff, 0x89, 0x11, 0x11}; + v4i8_s = (v4i8) {0xff, 0xbd, 0x67, 0x89}; + v4i8_r = __builtin_mips_addu_s_qb (v4i8_a, v4i8_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + v2q15_s = (v2q15) {0xa2ab, 0x4567}; + v2q15_r = sub_v2q15 (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x8000, 0x5678}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + v2q15_s = (v2q15) {0x8000, 0x4567}; + v2q15_r = __builtin_mips_subq_s_ph (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = 0x70000000; + q31_b = 0x71234567; + q31_s = 0xfedcba99; + q31_r = __builtin_mips_subq_s_w (q31_a, q31_b); + if(q31_r != q31_s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0xff, 0x89, 0x11, 0x11}; + v4i8_s = (v4i8) {0xf3, 0xab, 0x45, 0x67}; + v4i8_r = sub_v4i8 (v4i8_a, v4i8_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0xff, 0x89, 0x11, 0x11}; + v4i8_s = (v4i8) {0x0, 0x0, 0x45, 0x67}; + v4i8_r = __builtin_mips_subu_s_qb (v4i8_a, v4i8_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + i32_a = 0xf5678900; + i32_b = 0x7abcdef0; + i32_s = 0x702467f0; + i32_r = __builtin_mips_addsc (i32_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_a = 0x75678900; + i32_b = 0x7abcdef0; + i32_s = 0xf02467f1; + i32_r = __builtin_mips_addwc (i32_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_a = 0; + i32_b = 0x00000901; + i32_s = 9; + i32_r = __builtin_mips_modsub (i32_a, i32_b); + if(i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + i32_s = 0x1f4; + i32_r = __builtin_mips_raddu_w_qb (v4i8_a); + if(i32_r != i32_s) + abort (); + + v2q15_a = (v2q15) {0x8000, 0x8134}; + v2q15_s = (v2q15) {0x7fff, 0x7ecc}; + v2q15_r = __builtin_mips_absq_s_ph (v2q15_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = (q31) 0x80000000; + q31_s = (q31) 0x7fffffff; + q31_r = __builtin_mips_absq_s_w (q31_a); + if(q31_r != q31_s) + abort (); + + v2q15_a = (v2q15) {0x9999, 0x5612}; + v2q15_b = (v2q15) {0x5612, 0x3333}; + if (little_endian) + v4i8_s = (v4i8) {0x56, 0x33, 0x99, 0x56}; + else + v4i8_s = (v4i8) {0x99, 0x56, 0x56, 0x33}; + v4i8_r = __builtin_mips_precrq_qb_ph (v2q15_a, v2q15_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + q31_a = 0x12348678; + q31_b = 0x44445555; + if (little_endian) + v2q15_s = (v2q15) {0x4444, 0x1234}; + else + v2q15_s = (v2q15) {0x1234, 0x4444}; + v2q15_r = __builtin_mips_precrq_ph_w (q31_a, q31_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = 0x12348678; + q31_b = 0x44445555; + if (little_endian) + v2q15_s = (v2q15) {0x4444, 0x1235}; + else + v2q15_s = (v2q15) {0x1235, 0x4444}; + v2q15_r = __builtin_mips_precrq_rs_ph_w (q31_a, q31_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x9999, 0x5612}; + v2q15_b = (v2q15) {0x5612, 0x3333}; + if (little_endian) + v4i8_s = (v4i8) {0xac, 0x66, 0x00, 0xac}; + else + v4i8_s = (v4i8) {0x00, 0xac, 0xac, 0x66}; + v4i8_r = __builtin_mips_precrqu_s_qb_ph (v2q15_a, v2q15_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x3589, 0x4444}; + if (little_endian) + q31_s = 0x44440000; + else + q31_s = 0x35890000; + q31_r = __builtin_mips_preceq_w_phl (v2q15_a); + if(q31_r != q31_s) + abort (); + + v2q15_a = (v2q15) {0x3589, 0x4444}; + if (little_endian) + q31_s = 0x35890000; + else + q31_s = 0x44440000; + q31_r = __builtin_mips_preceq_w_phr (v2q15_a); + if(q31_r != q31_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x2b00, 0x1980}; + else + v2q15_s = (v2q15) {0x0900, 0x2b00}; + v2q15_r = __builtin_mips_precequ_ph_qbl (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x0900, 0x2b00}; + else + v2q15_s = (v2q15) {0x2b00, 0x1980}; + v2q15_r = __builtin_mips_precequ_ph_qbr (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x2b00, 0x1980}; + else + v2q15_s = (v2q15) {0x0900, 0x2b00}; + v2q15_r = __builtin_mips_precequ_ph_qbla (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x0900, 0x2b00}; + else + v2q15_s = (v2q15) {0x2b00, 0x1980}; + v2q15_r = __builtin_mips_precequ_ph_qbra (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x56, 0x33}; + else + v2q15_s = (v2q15) {0x12, 0x56}; + v2q15_r = __builtin_mips_preceu_ph_qbl (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x56, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x12, 0x56}; + else + v2q15_s = (v2q15) {0x56, 0x33}; + v2q15_r = __builtin_mips_preceu_ph_qbr (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x99, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x99, 0x33}; + else + v2q15_s = (v2q15) {0x12, 0x56}; + v2q15_r = __builtin_mips_preceu_ph_qbla (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x99, 0x56, 0x33}; + if (little_endian) + v2q15_s = (v2q15) {0x12, 0x56}; + else + v2q15_s = (v2q15) {0x99, 0x33}; + v2q15_r = __builtin_mips_preceu_ph_qbra (v4i8_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_s = (v4i8) {0xc8, 0xd0, 0x58, 0xe0}; + v4i8_r = __builtin_mips_shll_qb (v4i8_a, 2); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + i32_b = 1; + v4i8_s = (v4i8) {0xe4, 0x68, 0xac, 0xf0}; + v4i8_r = __builtin_mips_shll_qb (v4i8_a, i32_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_s = (v2q15) {0x48d0, 0x59e0}; + v2q15_r = __builtin_mips_shll_ph (v2q15_a, 2); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + i32_b = 1; + v2q15_s = (v2q15) {0x2468, 0xacf0}; + v2q15_r = __builtin_mips_shll_ph (v2q15_a, i32_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_s = (v2q15) {0x48d0, 0x7fff}; + v2q15_r = __builtin_mips_shll_s_ph (v2q15_a, 2); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + i32_b = 1; + v2q15_s = (v2q15) {0x2468, 0x7fff}; + v2q15_r = __builtin_mips_shll_s_ph (v2q15_a, i32_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = 0x70000000; + q31_s = 0x7fffffff; + q31_r = __builtin_mips_shll_s_w (q31_a, 2); + if(q31_r != q31_s) + abort (); + + q31_a = 0x70000000; + i32_b = 1; + q31_s = 0x7fffffff; + q31_r = __builtin_mips_shll_s_w (q31_a, i32_b); + if(q31_r != q31_s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + v4i8_s = (v4i8) {0x3c, 0xd, 0x15, 0x1e}; + v4i8_r = __builtin_mips_shrl_qb (v4i8_a, 2); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0xf2, 0x34, 0x56, 0x78}; + i32_b = 1; + v4i8_s = (v4i8) {0x79, 0x1a, 0x2b, 0x3c}; + v4i8_r = __builtin_mips_shrl_qb (v4i8_a, i32_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_s = (v2q15) {0x48d, 0x159e}; + v2q15_r = __builtin_mips_shra_ph (v2q15_a, 2); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + i32_b = 1; + v2q15_s = (v2q15) {0x91a, 0x2b3c}; + v2q15_r = __builtin_mips_shra_ph (v2q15_a, i32_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_s = (v2q15) {0x48d, 0x159e}; + v2q15_r = __builtin_mips_shra_r_ph (v2q15_a, 2); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + i32_b = 3; + v2q15_s = (v2q15) {0x247, 0xacf}; + v2q15_r = __builtin_mips_shra_r_ph (v2q15_a, i32_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + q31_a = 0x70000000; + q31_s = 0x1c000000; + q31_r = __builtin_mips_shra_r_w (q31_a, 2); + if(q31_r != q31_s) + abort (); + + q31_a = 0x70000004; + i32_b = 3; + q31_s = 0x0e000001; + q31_r = __builtin_mips_shra_r_w (q31_a, i32_b); + if(q31_r != q31_s) + abort (); + + v4i8_a = (v4i8) {0x1, 0x2, 0x3, 0x4}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + if (little_endian) + v2q15_s = (v2q15) {0xffff, 0x4444}; + else + v2q15_s = (v2q15) {0x6f89, 0x2222}; + v2q15_r = __builtin_mips_muleu_s_ph_qbl (v4i8_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x1, 0x2, 0x3, 0x4}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + if (little_endian) + v2q15_s = (v2q15) {0x6f89, 0x2222}; + else + v2q15_s = (v2q15) {0xffff, 0x4444}; + v2q15_r = __builtin_mips_muleu_s_ph_qbr (v4i8_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x6f89, 0x1111}; + v2q15_s = (v2q15) {0x0fdd, 0x0b87}; + v2q15_r = __builtin_mips_mulq_rs_ph (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x8000, 0x8000}; + v2q15_b = (v2q15) {0x8000, 0x8000}; + q31_s = 0x7fffffff; + q31_r = __builtin_mips_muleq_s_w_phl (v2q15_a, v2q15_b); + if(q31_r != q31_s) + abort (); + + v2q15_a = (v2q15) {0x8000, 0x8000}; + v2q15_b = (v2q15) {0x8000, 0x8000}; + q31_s = 0x7fffffff; + q31_r = __builtin_mips_muleq_s_w_phr (v2q15_a, v2q15_b); + if(q31_r != q31_s) + abort (); + +#ifndef __mips64 + a64_a = 0x22221111; + v4i8_b = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_c = (v4i8) {0xaa, 0x89, 0x11, 0x34}; + if (little_endian) + a64_s = 0x22222f27; + else + a64_s = 0x222238d9; + a64_r = __builtin_mips_dpau_h_qbl (a64_a, v4i8_b, v4i8_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x22221111; + v4i8_b = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_c = (v4i8) {0xaa, 0x89, 0x11, 0x34}; + if (little_endian) + a64_s = 0x222238d9; + else + a64_s = 0x22222f27; + a64_r = __builtin_mips_dpau_h_qbr (a64_a, v4i8_b, v4i8_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x22221111; + v4i8_b = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_c = (v4i8) {0xaa, 0x89, 0x11, 0x34}; + if (little_endian) + a64_s = 0x2221f2fb; + else + a64_s = 0x2221e949; + a64_r = __builtin_mips_dpsu_h_qbl (a64_a, v4i8_b, v4i8_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x22221111; + v4i8_b = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_c = (v4i8) {0xaa, 0x89, 0x11, 0x34}; + if (little_endian) + a64_s = 0x2221e949; + else + a64_s = 0x2221f2fb; + a64_r = __builtin_mips_dpsu_h_qbr (a64_a, v4i8_b, v4i8_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x5678}; + v2q15_c = (v2q15) {0x8000, 0x1111}; + a64_s = 0x8b877d00; + a64_r = __builtin_mips_dpaq_s_w_ph (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x5678}; + v2q15_c = (v2q15) {0x8000, 0x1111}; + a64_s = 0xffffffff7478a522LL; + a64_r = __builtin_mips_dpsq_s_w_ph (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x5678}; + v2q15_c = (v2q15) {0x8000, 0x1111}; + if (little_endian) + a64_s = 0xffffffff8b877d02LL; + else + a64_s = 0x7478a520; + a64_r = __builtin_mips_mulsaq_s_w_ph (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + q31_b = 0x80000000; + q31_c = 0x80000000; + a64_s = 0x7fffffffffffffffLL; + a64_r = __builtin_mips_dpaq_sa_l_w (a64_a, q31_b, q31_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + q31_b = 0x80000000; + q31_c = 0x80000000; + a64_s = 0x8000000000001112LL; + a64_r = __builtin_mips_dpsq_sa_l_w (a64_a, q31_b, q31_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x1}; + v2q15_c = (v2q15) {0x8000, 0x2}; + if (little_endian) + a64_s = 0x1115; + else + a64_s = 0x80001110; + a64_r = __builtin_mips_maq_s_w_phl (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x1}; + v2q15_c = (v2q15) {0x8000, 0x2}; + if (little_endian) + a64_s = 0x80001110; + else + a64_s = 0x1115; + a64_r = __builtin_mips_maq_s_w_phr (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x1}; + v2q15_c = (v2q15) {0x8000, 0x2}; + if (little_endian) + a64_s = 0x1115; + else + a64_s = 0x7fffffff; + a64_r = __builtin_mips_maq_sa_w_phl (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); + + a64_a = 0x00001111; + v2q15_b = (v2q15) {0x8000, 0x1}; + v2q15_c = (v2q15) {0x8000, 0x2}; + if (little_endian) + a64_s = 0x7fffffff; + else + a64_s = 0x1115; + a64_r = __builtin_mips_maq_sa_w_phr (a64_a, v2q15_b, v2q15_c); + if(a64_r != a64_s) + abort (); +#endif + + i32_a = 0x12345678; + i32_s = 0x00001e6a; + i32_r = __builtin_mips_bitrev (i32_a); + if(i32_r != i32_s) + abort (); + + i32_a = 0x00000208; // pos is 8, size is 4 + __builtin_mips_wrdsp (i32_a, 31); + i32_a = 0x12345678; + i32_b = 0x87654321; + i32_s = 0x12345178; + i32_r = __builtin_mips_insv (i32_a, i32_b); + if(i32_r != i32_s) + abort (); + + v4i8_s = (v4i8) {1, 1, 1, 1}; + v4i8_r = __builtin_mips_repl_qb (1); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + i32_a = 99; + v4i8_s = (v4i8) {99, 99, 99, 99}; + v4i8_r = __builtin_mips_repl_qb (i32_a); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + v2q15_s = (v2q15) {30, 30}; + v2q15_r = __builtin_mips_repl_ph (30); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + i32_a = 0x5612; + v2q15_s = (v2q15) {0x5612, 0x5612}; + v2q15_r = __builtin_mips_repl_ph (i32_a); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x03000000; + else + i32_s = 0x0c000000; + __builtin_mips_cmpu_eq_qb (v4i8_a, v4i8_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x04000000; + else + i32_s = 0x02000000; + __builtin_mips_cmpu_lt_qb (v4i8_a, v4i8_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x07000000; + else + i32_s = 0x0e000000; + __builtin_mips_cmpu_le_qb (v4i8_a, v4i8_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x3; + else + i32_s = 0xc; + i32_r=__builtin_mips_cmpgu_eq_qb (v4i8_a, v4i8_b); + if (i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x4; + else + i32_s = 0x2; + i32_r = __builtin_mips_cmpgu_lt_qb (v4i8_a, v4i8_b); + if (i32_r != i32_s) + abort (); + + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x12, 0x34, 0x78, 0x56}; + if (little_endian) + i32_s = 0x7; + else + i32_s = 0xe; + i32_r = __builtin_mips_cmpgu_le_qb (v4i8_a, v4i8_b); + if (i32_r != i32_s) + abort (); + + __builtin_mips_wrdsp (0,31); // Clear all condition code bits. + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x1234, 0x7856}; + if (little_endian) + i32_s = 0x01000000; + else + i32_s = 0x02000000; + __builtin_mips_cmp_eq_ph (v2q15_a, v2q15_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x1234, 0x7856}; + if (little_endian) + i32_s = 0x02000000; + else + i32_s = 0x01000000; + __builtin_mips_cmp_lt_ph (v2q15_a, v2q15_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x1234, 0x7856}; + i32_s = 0x03000000; + __builtin_mips_cmp_le_ph (v2q15_a, v2q15_b); + i32_r = __builtin_mips_rddsp (16); + if (i32_r != i32_s) + abort (); + + i32_a = 0x0a000000; // cc: 0000 1010 + __builtin_mips_wrdsp (i32_a, 31); + v4i8_a = (v4i8) {0x12, 0x34, 0x56, 0x78}; + v4i8_b = (v4i8) {0x21, 0x43, 0x65, 0x87}; + if (little_endian) + v4i8_s = (v4i8) {0x21, 0x34, 0x65, 0x78}; + else + v4i8_s = (v4i8) {0x12, 0x43, 0x56, 0x87}; + v4i8_r = __builtin_mips_pick_qb (v4i8_a, v4i8_b); + r = (int) v4i8_r; + s = (int) v4i8_s; + if(r != s) + abort (); + + i32_a = 0x02000000; // cc: 0000 0010 + __builtin_mips_wrdsp (i32_a, 31); + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x2143, 0x6587}; + if (little_endian) + v2q15_s = (v2q15) {0x2143, 0x5678}; + else + v2q15_s = (v2q15) {0x1234, 0x6587}; + v2q15_r = __builtin_mips_pick_ph (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + + v2q15_a = (v2q15) {0x1234, 0x5678}; + v2q15_b = (v2q15) {0x1234, 0x7856}; + if (little_endian) + v2q15_s = (v2q15) {0x7856, 0x1234}; + else + v2q15_s = (v2q15) {0x5678, 0x1234}; + v2q15_r = __builtin_mips_packrl_ph (v2q15_a, v2q15_b); + r = (int) v2q15_r; + s = (int) v2q15_s; + if(r != s) + abort (); + +#ifndef __mips64 + a64_a = 0x1234567887654321LL; + i32_s = 0x88765432; + i32_r = __builtin_mips_extr_w (a64_a, 4); + if(i32_r != i32_s) + abort (); + + a64_a = 0x1234567887658321LL; + i32_s = 0x56788766; + i32_r = __builtin_mips_extr_r_w (a64_a, 16); + if(i32_r != i32_s) + abort (); + + a64_a = 0x12345677fffffff8LL; + i32_s = 0x7fffffff; + i32_r = __builtin_mips_extr_rs_w (a64_a, 4); + if(i32_r != i32_s) + abort (); + + a64_a = 0x1234567887658321LL; + i32_s = 0x7fff; + i32_r = __builtin_mips_extr_s_h (a64_a, 16); + if(i32_r != i32_s) + abort (); + + a64_a = 0x0000007887658321LL; + i32_b = 24; + i32_s = 0x7887; + i32_r = __builtin_mips_extr_s_h (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + a64_a = 0x1234567887654321LL; + i32_b = 4; + i32_s = 0x88765432; + i32_r = __builtin_mips_extr_w (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + a64_a = 0x1234567887658321LL; + i32_b = 16; + i32_s = 0x56788766; + i32_r = __builtin_mips_extr_r_w (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + a64_a = 0x12345677fffffff8LL; + i32_b = 4; + i32_s = 0x7fffffff; + i32_r = __builtin_mips_extr_rs_w (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_a = 0x0000021f; // pos is 31 + __builtin_mips_wrdsp (i32_a, 31); + a64_a = 0x1234567887654321LL; + i32_s = 8; + i32_r = __builtin_mips_extp (a64_a, 3); // extract 4 bits + if(i32_r != i32_s) + abort (); + + i32_a = 0x0000021f; // pos is 31 + __builtin_mips_wrdsp (i32_a, 31); + a64_a = 0x1234567887654321LL; + i32_b = 7; // size is 8. NOTE!! we should use 7 + i32_s = 0x87; + i32_r = __builtin_mips_extp (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_a = 0x0000021f; // pos is 31 + __builtin_mips_wrdsp (i32_a, 31); + a64_a = 0x1234567887654321LL; + i32_s = 8; + i32_r = __builtin_mips_extpdp (a64_a, 3); // extract 4 bits + if(i32_r != i32_s) + abort (); + + i32_s = 0x0000021b; // pos is 27 + i32_r = __builtin_mips_rddsp (31); + if (i32_r != i32_s) + abort (); + + i32_a = 0x0000021f; // pos is 31 + __builtin_mips_wrdsp (i32_a, 31); + a64_a = 0x1234567887654321LL; + i32_b = 11; // size is 12. NOTE!!! We should use 11 + i32_s = 0x876; + i32_r = __builtin_mips_extpdp (a64_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_s = 0x00000213; // pos is 19 + i32_r = __builtin_mips_rddsp (31); + if (i32_r != i32_s) + abort (); + + a64_a = 0x1234567887654321LL; + a64_s = 0x0012345678876543LL; + a64_r = __builtin_mips_shilo (a64_a, 8); + if(a64_r != a64_s) + abort (); + + a64_a = 0x1234567887654321LL; + i32_b = -16; + a64_s = 0x5678876543210000LL; + a64_r = __builtin_mips_shilo (a64_a, i32_b); + if(a64_r != a64_s) + abort (); + + i32_a = 0x0; + __builtin_mips_wrdsp (i32_a, 31); + a64_a = 0x1234567887654321LL; + i32_b = 0x11112222; + a64_s = 0x8765432111112222LL; + a64_r = __builtin_mips_mthlip (a64_a, i32_b); + if(a64_r != a64_s) + abort (); + i32_s = 32; + i32_r = __builtin_mips_rddsp (31); + if(i32_r != i32_s) + abort (); +#endif + + i32_a = 0x1357a468; + __builtin_mips_wrdsp (i32_a, 63); + i32_s = 0x03572428; + i32_r = __builtin_mips_rddsp (63); + if(i32_r != i32_s) + abort (); + + ptr_a = &array; + i32_b = 37; + i32_s = 37; + i32_r = __builtin_mips_lbux (ptr_a, i32_b); + if(i32_r != i32_s) + abort (); + + ptr_a = &array; + i32_b = 38; + if (little_endian) + i32_s = 0x2726; + else + i32_s = 0x2627; + i32_r = __builtin_mips_lhx (ptr_a, i32_b); + if(i32_r != i32_s) + abort (); + + ptr_a = &array; + i32_b = 40; + if (little_endian) + i32_s = 0x2b2a2928; + else + i32_s = 0x28292a2b; + i32_r = __builtin_mips_lwx (ptr_a, i32_b); + if(i32_r != i32_s) + abort (); + + i32_a = 0x00000220; // pos is 32, size is 4 + __builtin_mips_wrdsp (i32_a, 63); + i32_s = 1; + i32_r = __builtin_mips_bposge32 (); + if(i32_r != i32_s) + abort (); +} +
mips32-dsp.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: movcc-1.c =================================================================== --- movcc-1.c (nonexistent) +++ movcc-1.c (revision 154) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mips4" } */ +/* { dg-final { scan-assembler "movz" } } */ +/* { dg-final { scan-assembler "movn" } } */ + +void ext_int (int); + +int +sub1 (int i, int j, int k) +{ + ext_int (k ? i : j); +} + +int +sub2 (int i, int j, long l) +{ + ext_int (!l ? i : j); +}
movcc-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: movcc-2.c =================================================================== --- movcc-2.c (nonexistent) +++ movcc-2.c (revision 154) @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mips4" } */ +/* { dg-final { scan-assembler "movz" } } */ +/* { dg-final { scan-assembler "movn" } } */ + +void ext_long (long); + +long +sub4 (long i, long j, long k) +{ + ext_long (k ? i : j); +} + +long +sub5 (long i, long j, int k) +{ + ext_long (!k ? i : j); +}
movcc-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: movcc-3.c =================================================================== --- movcc-3.c (nonexistent) +++ movcc-3.c (revision 154) @@ -0,0 +1,63 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "movt" } } */ +/* { dg-final { scan-assembler "movf" } } */ +/* { dg-final { scan-assembler "movz.s" } } */ +/* { dg-final { scan-assembler "movn.s" } } */ +/* { dg-final { scan-assembler "movt.s" } } */ +/* { dg-final { scan-assembler "movz.d" } } */ +/* { dg-final { scan-assembler "movn.d" } } */ +/* { dg-final { scan-assembler "movf.d" } } */ + +void ext_int (int); +void ext_long (long); +void ext_float (float); +void ext_double (double); + +int +sub3 (int i, int j, float f) +{ + ext_int (f ? i : j); +} + +long +sub6 (long i, long j, float f) +{ + ext_long (!f ? i : j); +} + +float +sub7 (float f, float g, int i) +{ + ext_float (i ? f : g); +} + +float +sub8 (float f, float g, long l) +{ + ext_float (!l ? f : g); +} + +float +sub9 (float f, float g, float h) +{ + ext_float (h ? f : g); +} + +double +suba (double f, double g, int i) +{ + ext_double (i ? f : g); +} + +double +subb (double f, double g, long l) +{ + ext_double (!l ? f : g); +} + +double +subc (double f, double g, double h) +{ + ext_double (!h ? f : g); +}
movcc-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-ps-type.c =================================================================== --- mips-ps-type.c (nonexistent) +++ mips-ps-type.c (revision 154) @@ -0,0 +1,111 @@ +/* Test v2sf calculations. The nmadd and nmsub patterns need + -ffinite-math-only. */ +/* { dg-do compile } */ +/* { dg-mips-options "-mips64 -O2 -mpaired-single -mhard-float -mgp64 -ffinite-math-only" } */ +/* { dg-final { scan-assembler "cvt.ps.s" } } */ +/* { dg-final { scan-assembler "mov.ps" } } */ +/* { dg-final { scan-assembler "ldc1" } } */ +/* { dg-final { scan-assembler "sdc1" } } */ +/* { dg-final { scan-assembler "add.ps" } } */ +/* { dg-final { scan-assembler "sub.ps" } } */ +/* { dg-final { scan-assembler "neg.ps" } } */ +/* { dg-final { scan-assembler "mul.ps" } } */ +/* { dg-final { scan-assembler "madd.ps" } } */ +/* { dg-final { scan-assembler "msub.ps" } } */ +/* { dg-final { scan-assembler "nmadd.ps" } } */ +/* { dg-final { scan-assembler "nmsub.ps" } } */ +/* { dg-final { scan-assembler "mov(n|z).ps" } } */ + +typedef float v2sf __attribute__ ((vector_size(8))); + +v2sf A = {100, 200}; + +/* Init from floats */ +v2sf init (float a, float b) +{ + return (v2sf) {a, b}; +} + +/* Move between registers */ +v2sf move (v2sf a) +{ + return a; +} + +/* Load from memory */ +v2sf load () +{ + return A; +} + +/* Store to memory */ +void store (v2sf a) +{ + A = a; +} + +/* Add */ +v2sf add (v2sf a, v2sf b) +{ + return a + b; +} + +/* Subtract */ +v2sf sub (v2sf a, v2sf b) +{ + return a - b; +} + +/* Negate */ +v2sf neg (v2sf a) +{ + return - a; +} + +/* Multiply */ +v2sf mul (v2sf a, v2sf b) +{ + return a * b; +} + +/* Multiply and add */ +v2sf madd (v2sf a, v2sf b, v2sf c) +{ + return a * b + c; +} + +/* Multiply and subtract */ +v2sf msub (v2sf a, v2sf b, v2sf c) +{ + return a * b - c; +} + +/* Negate Multiply and add */ +v2sf nmadd (v2sf a, v2sf b, v2sf c) +{ + return - (a * b + c); +} + +/* Negate Multiply and subtract */ +v2sf nmsub (v2sf a, v2sf b, v2sf c) +{ + return - (a * b - c); +} + +/* Conditional Move */ +v2sf cond_move1 (v2sf a, v2sf b, long i) +{ + if (i > 0) + return a; + else + return b; +} + +/* Conditional Move */ +v2sf cond_move2 (v2sf a, v2sf b, int i) +{ + if (i > 0) + return a; + else + return b; +}
mips-ps-type.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ext_ins.c =================================================================== --- ext_ins.c (nonexistent) +++ ext_ins.c (revision 154) @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-march=mips32r2" } */ +/* { dg-final { scan-assembler "ext" } } */ +/* { dg-final { scan-assembler "ins" } } */ + +struct A +{ + unsigned int i : 2; + unsigned int j : 3; + unsigned int k : 4; + unsigned int l : 5; +}; + +void func (struct A); + +unsigned int f1 (struct A a) +{ + return a.j; +} + +void f2 (int i) +{ + struct A c; + c.j = i; + func (c); +}
ext_ins.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rsqrt-1.c =================================================================== --- rsqrt-1.c (nonexistent) +++ rsqrt-1.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "rsqrt.d" } } */ +/* { dg-final { scan-assembler "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return 1.0/sqrt(x); +} + +float bar(float x) +{ + return 1.0f/sqrtf(x); +}
rsqrt-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-1.c =================================================================== --- mips-3d-1.c (nonexistent) +++ mips-3d-1.c (revision 154) @@ -0,0 +1,127 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int main () +{ + int little_endian; + v2sf a, b, c, d; + float f1, f2, f3, f4, f5, f6; + double d1, d2, d3, d4, d5, d6, d7, d8, d9; + v2sf ps1, ps2, ps3, ps4, ps5, ps6; + + union { long long ll; int i[2]; } endianness_test; + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + /* addr.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {45, 67}; + c = __builtin_mips_addr_ps (a, b); + if (little_endian) + d = (v2sf) {112, 46}; + else + d = (v2sf) {46, 112}; + + if (!__builtin_mips_all_c_eq_ps(c, d)) + abort (); + + /* mulr.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {45, 67}; + c = __builtin_mips_mulr_ps (a, b); + if (little_endian) + d = (v2sf) {3015, 408}; + else + d = (v2sf) {408, 3015}; + + if (!__builtin_mips_all_c_eq_ps(c, d)) + abort (); + + /* cvt.pw.ps */ + a = (v2sf) {12345.34, 67890.45}; + b = __builtin_mips_cvt_pw_ps (a); + + /* cvt.ps.pw */ + c = __builtin_mips_cvt_ps_pw (b); + d = (v2sf) {12345.0, 67890.0}; + + if (!__builtin_mips_all_c_eq_ps(c, d)) + abort (); + + /* recip1.s recip2.s */ + f1 = 40; + f2 = __builtin_mips_recip1_s (f1); + f3 = __builtin_mips_recip2_s (f2, f1); + f4 = f2 + f2 * f3; + f5 = 0.025; + + if (f4 != f5) + abort (); + + /* recip1.d recip2.d */ + d1 = 80; + d2 = __builtin_mips_recip1_d (d1); + d3 = __builtin_mips_recip2_d (d2, d1); + d4 = d2 + d2 * d3; + d5 = __builtin_mips_recip2_d (d4, d1); + d6 = d4 + d4 * d5; + d7 = 0.0125; + + if (d6 != d7) + abort (); + + /* recip1.ps recip2.ps */ + ps1 = (v2sf) {100, 200}; + ps2 = __builtin_mips_recip1_ps (ps1); + ps3 = __builtin_mips_recip2_ps (ps2, ps1); + ps4 = ps2 + ps2 * ps3; + ps5 = (v2sf) {0.01, 0.005}; + + if (!__builtin_mips_all_c_eq_ps(ps4, ps5)) + abort (); + + /* rsqrt1.s rsqrt2.s */ + f1 = 400; + f2 = __builtin_mips_rsqrt1_s (f1); + f3 = f2 * f1; + f4 = __builtin_mips_rsqrt2_s (f3, f2); + f5 = f2 + f2 * f4; + f6 = 0.05; + + if (f5 != f6) + abort (); + + /* rsqrt1.d rsqrt2.d */ + d1 = 1600; + d2 = __builtin_mips_rsqrt1_d (d1); + d3 = d2 * d1; + d4 = __builtin_mips_rsqrt2_d (d3, d2); + d5 = d2 + d2 * d4; + d6 = d1 * d5; + d7 = __builtin_mips_rsqrt2_d (d6, d5); + d8 = d5 + d5 * d7; + d9 = 0.025; + + if (d8 != d9) + abort (); + + /* rsqrt1.ps rsqrt2.ps */ + ps1 = (v2sf) {400, 100}; + ps2 = __builtin_mips_rsqrt1_ps (ps1); + ps3 = ps2 * ps1; + ps4 = __builtin_mips_rsqrt2_ps (ps3, ps2); + ps5 = ps2 + ps2 * ps4; + ps6 = (v2sf) {0.05, 0.1}; + + if (!__builtin_mips_all_c_eq_ps(ps5, ps6)) + abort (); + + printf ("Test Passes\n"); + exit (0); +}
mips-3d-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: neg-abs-1.c =================================================================== --- neg-abs-1.c (nonexistent) +++ neg-abs-1.c (revision 154) @@ -0,0 +1,13 @@ +/* Make sure that we use abs.fmt and neg.fmt when the signs of NaNs don't + matter. */ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mhard-float -ffinite-math-only" } */ +/* { dg-final { scan-assembler "neg.s" } } */ +/* { dg-final { scan-assembler "neg.d" } } */ +/* { dg-final { scan-assembler "abs.s" } } */ +/* { dg-final { scan-assembler "abs.d" } } */ + +float f1 (float f) { return -f; } +float f2 (float f) { return __builtin_fabsf (f); } +double d1 (double d) { return -d; } +double d2 (double d) { return __builtin_fabs (d); }
neg-abs-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rsqrt-2.c =================================================================== --- rsqrt-2.c (nonexistent) +++ rsqrt-2.c (revision 154) @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "rsqrt.d" } } */ +/* { dg-final { scan-assembler "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return sqrt(1.0/x); +} + +float bar(float x) +{ + return sqrtf(1.0f/x); +}
rsqrt-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-2.c =================================================================== --- mips-3d-2.c (nonexistent) +++ mips-3d-2.c (revision 154) @@ -0,0 +1,554 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D branch-if-any-two builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int test0 (v2sf a, v2sf b); +int test1 (v2sf a, v2sf b); +int test2 (v2sf a, v2sf b); +int test3 (v2sf a, v2sf b); +int test4 (v2sf a, v2sf b); +int test5 (v2sf a, v2sf b); +int test6 (v2sf a, v2sf b); +int test7 (v2sf a, v2sf b); +int test8 (v2sf a, v2sf b); +int test9 (v2sf a, v2sf b); +int test10 (v2sf a, v2sf b); +int test11 (v2sf a, v2sf b); +int test12 (v2sf a, v2sf b); +int test13 (v2sf a, v2sf b); +int test14 (v2sf a, v2sf b); +int test15 (v2sf a, v2sf b); +int test16 (v2sf a, v2sf b); +int test17 (v2sf a, v2sf b); +int test18 (v2sf a, v2sf b); +int test19 (v2sf a, v2sf b); +int test20 (v2sf a, v2sf b); +int test21 (v2sf a, v2sf b); +int test22 (v2sf a, v2sf b); +int test23 (v2sf a, v2sf b); +int test24 (v2sf a, v2sf b); +int test25 (v2sf a, v2sf b); +int test26 (v2sf a, v2sf b); +int test27 (v2sf a, v2sf b); +int test28 (v2sf a, v2sf b); +int test29 (v2sf a, v2sf b); +int test30 (v2sf a, v2sf b); +int test31 (v2sf a, v2sf b); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + v2sf a, b, c, d; + int i, j; + + /* c.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {56, 78}; + i = 0; + j = 0; + if (__builtin_mips_any_c_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_all_c_eq_ps(a, b) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {12, 78}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_all_c_eq_ps(a, b) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {56, 34}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_all_c_eq_ps(a, b) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {12, 34}; + i = 1; + j = 1; + if (__builtin_mips_any_c_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_all_c_eq_ps(a, b) != j) + abort (); + + /* Test with 16 operators */ + a = (v2sf) {10.58, 1984.0}; + b = (v2sf) {567.345, 1984.0}; + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 0) + abort (); + i = test4 (a, b); + if (i != 1) + abort (); + i = test5 (a, b); + if (i != 0) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 0) + abort (); + i = test8 (a, b); + if (i != 1) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 0) + abort (); + i = test12 (a, b); + if (i != 1) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + i = test16 (a, b); + if (i != 0) + abort (); + i = test17 (a, b); + if (i != 0) + abort (); + i = test18 (a, b); + if (i != 0) + abort (); + i = test19 (a, b); + if (i != 0) + abort (); + i = test20 (a, b); + if (i != 1) + abort (); + i = test21 (a, b); + if (i != 0) + abort (); + i = test22 (a, b); + if (i != 1) + abort (); + i = test23 (a, b); + if (i != 0) + abort (); + i = test24 (a, b); + if (i != 1) + abort (); + i = test25 (a, b); + if (i != 0) + abort (); + i = test26 (a, b); + if (i != 1) + abort (); + i = test27 (a, b); + if (i != 0) + abort (); + i = test28 (a, b); + if (i != 1) + abort (); + i = test29 (a, b); + if (i != 1) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); + + /* Reverse arguments */ + i = test0 (b, a); + if (i != 0) + abort (); + i = test1 (b, a); + if (i != 0) + abort (); + i = test2 (b, a); + if (i != 0) + abort (); + i = test3 (b, a); + if (i != 0) + abort (); + i = test4 (b, a); + if (i != 1) + abort (); + i = test5 (b, a); + if (i != 0) + abort (); + i = test6 (b, a); + if (i != 1) + abort (); + i = test7 (b, a); + if (i != 0) + abort (); + i = test8 (b, a); + if (i != 0) + abort (); + i = test9 (b, a); + if (i != 0) + abort (); + i = test10 (b, a); + if (i != 0) + abort (); + i = test11 (b, a); + if (i != 0) + abort (); + i = test12 (b, a); + if (i != 1) + abort (); + i = test13 (b, a); + if (i != 0) + abort (); + i = test14 (b, a); + if (i != 1) + abort (); + i = test15 (b, a); + if (i != 0) + abort (); + i = test16 (b, a); + if (i != 0) + abort (); + i = test17 (b, a); + if (i != 0) + abort (); + i = test18 (b, a); + if (i != 0) + abort (); + i = test19 (b, a); + if (i != 0) + abort (); + i = test20 (b, a); + if (i != 1) + abort (); + i = test21 (b, a); + if (i != 0) + abort (); + i = test22 (b, a); + if (i != 1) + abort (); + i = test23 (b, a); + if (i != 0) + abort (); + i = test24 (b, a); + if (i != 0) + abort (); + i = test25 (b, a); + if (i != 0) + abort (); + i = test26 (b, a); + if (i != 0) + abort (); + i = test27 (b, a); + if (i != 0) + abort (); + i = test28 (b, a); + if (i != 1) + abort (); + i = test29 (b, a); + if (i != 0) + abort (); + i = test30 (b, a); + if (i != 1) + abort (); + i = test31 (b, a); + if (i != 0) + abort (); + +#ifndef __FAST_MATH__ + /* Test with 16 operators */ + a = (v2sf) {qnan, qnan}; + b = (v2sf) {567.345, 1984.0}; + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 1) + abort (); + i = test3 (a, b); + if (i != 1) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 0) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 1) + abort (); + i = test12 (a, b); + if (i != 0) + abort (); + i = test13 (a, b); + if (i != 0) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + i = test16 (a, b); + if (i != 0) + abort (); + i = test17 (a, b); + if (i != 0) + abort (); + i = test18 (a, b); + if (i != 1) + abort (); + i = test19 (a, b); + if (i != 1) + abort (); + i = test20 (a, b); + if (i != 0) + abort (); + i = test21 (a, b); + if (i != 0) + abort (); + i = test22 (a, b); + if (i != 1) + abort (); + i = test23 (a, b); + if (i != 1) + abort (); + i = test24 (a, b); + if (i != 0) + abort (); + i = test25 (a, b); + if (i != 0) + abort (); + i = test26 (a, b); + if (i != 1) + abort (); + i = test27 (a, b); + if (i != 1) + abort (); + i = test28 (a, b); + if (i != 0) + abort (); + i = test29 (a, b); + if (i != 0) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_f_ps (a, b); +} + +int test1 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_f_ps (a, b); +} + +int test2 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_un_ps (a, b); +} + +int test3 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_un_ps (a, b); +} + +int test4 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_eq_ps (a, b); +} + +int test5 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_eq_ps (a, b); +} + +int test6 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ueq_ps (a, b); +} + +int test7 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ueq_ps (a, b); +} + +int test8 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_olt_ps (a, b); +} + +int test9 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_olt_ps (a, b); +} + +int test10 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ult_ps (a, b); +} + +int test11 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ult_ps (a, b); +} + +int test12 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ole_ps (a, b); +} + +int test13 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ole_ps (a, b); +} + +int test14 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ule_ps (a, b); +} + +int test15 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ule_ps (a, b); +} + +int test16 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_sf_ps (a, b); +} + +int test17 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_sf_ps (a, b); +} + +int test18 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ngle_ps (a, b); +} + +int test19 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ngle_ps (a, b); +} + +int test20 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_seq_ps (a, b); +} + +int test21 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_seq_ps (a, b); +} + +int test22 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ngl_ps (a, b); +} + +int test23 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ngl_ps (a, b); +} + +int test24 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_lt_ps (a, b); +} + +int test25 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_lt_ps (a, b); +} + +int test26 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_nge_ps (a, b); +} + +int test27 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_nge_ps (a, b); +} + +int test28 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_le_ps (a, b); +} + +int test29 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_le_ps (a, b); +} + +int test30 (v2sf a, v2sf b) +{ + return __builtin_mips_any_c_ngt_ps (a, b); +} + +int test31 (v2sf a, v2sf b) +{ + return __builtin_mips_all_c_ngt_ps (a, b); +}
mips-3d-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: neg-abs-2.c =================================================================== --- neg-abs-2.c (nonexistent) +++ neg-abs-2.c (revision 154) @@ -0,0 +1,13 @@ +/* Make sure that we avoid abs.fmt and neg.fmt when the signs of NaNs + matter. */ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mhard-float -fno-finite-math-only" } */ +/* { dg-final { scan-assembler-not "neg.s" } } */ +/* { dg-final { scan-assembler-not "neg.d" } } */ +/* { dg-final { scan-assembler-not "abs.s" } } */ +/* { dg-final { scan-assembler-not "abs.d" } } */ + +float f1 (float f) { return -f; } +float f2 (float f) { return __builtin_fabsf (f); } +double d1 (double d) { return -d; } +double d2 (double d) { return __builtin_fabs (d); }
neg-abs-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: rsqrt-3.c =================================================================== --- rsqrt-3.c (nonexistent) +++ rsqrt-3.c (revision 154) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler-not "rsqrt.d" } } */ +/* { dg-final { scan-assembler-not "rsqrt.s" } } */ + +extern double sqrt(double); +extern float sqrtf(float); + +double foo(double x) +{ + return 1.0/sqrt(x); +} + +double bar(double x) +{ + return sqrt(1.0/x); +} + +float foof(float x) +{ + return 1.0f/sqrtf(x); +} + +float barf(float x) +{ + return sqrtf(1.0f/x); +}
rsqrt-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-3.c =================================================================== --- mips-3d-3.c (nonexistent) +++ mips-3d-3.c (revision 154) @@ -0,0 +1,1095 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D absolute compare builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int test0 (v2sf a, v2sf b); +int test1 (v2sf a, v2sf b); +int test2 (v2sf a, v2sf b); +int test3 (v2sf a, v2sf b); +int test4 (v2sf a, v2sf b); +int test5 (v2sf a, v2sf b); +int test6 (v2sf a, v2sf b); +int test7 (v2sf a, v2sf b); +int test8 (v2sf a, v2sf b); +int test9 (v2sf a, v2sf b); +int test10 (v2sf a, v2sf b); +int test11 (v2sf a, v2sf b); +int test12 (v2sf a, v2sf b); +int test13 (v2sf a, v2sf b); +int test14 (v2sf a, v2sf b); +int test15 (v2sf a, v2sf b); +int test16 (v2sf a, v2sf b); +int test17 (v2sf a, v2sf b); +int test18 (v2sf a, v2sf b); +int test19 (v2sf a, v2sf b); +int test20 (v2sf a, v2sf b); +int test21 (v2sf a, v2sf b); +int test22 (v2sf a, v2sf b); +int test23 (v2sf a, v2sf b); +int test24 (v2sf a, v2sf b); +int test25 (v2sf a, v2sf b); +int test26 (v2sf a, v2sf b); +int test27 (v2sf a, v2sf b); +int test28 (v2sf a, v2sf b); +int test29 (v2sf a, v2sf b); +int test30 (v2sf a, v2sf b); +int test31 (v2sf a, v2sf b); +int test32 (v2sf a, v2sf b); +int test33 (v2sf a, v2sf b); +int test34 (v2sf a, v2sf b); +int test35 (v2sf a, v2sf b); +int test36 (v2sf a, v2sf b); +int test37 (v2sf a, v2sf b); +int test38 (v2sf a, v2sf b); +int test39 (v2sf a, v2sf b); +int test40 (v2sf a, v2sf b); +int test41 (v2sf a, v2sf b); +int test42 (v2sf a, v2sf b); +int test43 (v2sf a, v2sf b); +int test44 (v2sf a, v2sf b); +int test45 (v2sf a, v2sf b); +int test46 (v2sf a, v2sf b); +int test47 (v2sf a, v2sf b); +int test48 (v2sf a, v2sf b); +int test49 (v2sf a, v2sf b); +int test50 (v2sf a, v2sf b); +int test51 (v2sf a, v2sf b); +int test52 (v2sf a, v2sf b); +int test53 (v2sf a, v2sf b); +int test54 (v2sf a, v2sf b); +int test55 (v2sf a, v2sf b); +int test56 (v2sf a, v2sf b); +int test57 (v2sf a, v2sf b); +int test58 (v2sf a, v2sf b); +int test59 (v2sf a, v2sf b); +int test60 (v2sf a, v2sf b); +int test61 (v2sf a, v2sf b); +int test62 (v2sf a, v2sf b); +int test63 (v2sf a, v2sf b); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + int little_endian; + v2sf a, b, c, d; + int i, j, k, l; + + union { long long ll; int i[2]; } endianness_test; + endianness_test.ll = 1; + little_endian = endianness_test.i[0]; + + /* cabs.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {-56, -78}; + i = 0; + j = 0; + k = 0; + l = 0; + if (__builtin_mips_any_cabs_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) + abort (); + if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) + abort (); + if (__builtin_mips_all_cabs_eq_ps(a, b) != l) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {-12, -78}; + i = 1; + if (little_endian) + { + j = 0; + k = 1; + } + else + { + j = 1; + k = 0; + } + l = 0; + if (__builtin_mips_any_cabs_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) + abort (); + if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) + abort (); + if (__builtin_mips_all_cabs_eq_ps(a, b) != l) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {-56, -34}; + i = 1; + if (little_endian) + { + j = 1; + k = 0; + } + else + { + j = 0; + k = 1; + } + l = 0; + if (__builtin_mips_any_cabs_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) + abort (); + if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) + abort (); + if (__builtin_mips_all_cabs_eq_ps(a, b) != l) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {12, 34}; + b = (v2sf) {-12, -34}; + i = 1; + j = 1; + k = 1; + l = 1; + if (__builtin_mips_any_cabs_eq_ps(a, b) != i) + abort (); + if (__builtin_mips_upper_cabs_eq_ps(a, b) != j) + abort (); + if (__builtin_mips_lower_cabs_eq_ps(a, b) != k) + abort (); + if (__builtin_mips_all_cabs_eq_ps(a, b) != l) + abort (); + + /* Test all comparisons */ + if (little_endian) + { + a = (v2sf) {1984.0, 10.58}; + b = (v2sf) {-1984.0, -567.345}; + } + else + { + a = (v2sf) {10.58, 1984.0}; + b = (v2sf) {-567.345, -1984.0}; + } + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 0) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 0) + abort (); + i = test6 (a, b); + if (i != 0) + abort (); + i = test7 (a, b); + if (i != 0) + abort (); + i = test8 (a, b); + if (i != 1) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 0) + abort (); + i = test12 (a, b); + if (i != 1) + abort (); + i = test13 (a, b); + if (i != 0) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 0) + abort (); + i = test16 (a, b); + if (i != 1) + abort (); + i = test17 (a, b); + if (i != 1) + abort (); + i = test18 (a, b); + if (i != 0) + abort (); + i = test19 (a, b); + if (i != 0) + abort (); + i = test20 (a, b); + if (i != 1) + abort (); + i = test21 (a, b); + if (i != 1) + abort (); + i = test22 (a, b); + if (i != 0) + abort (); + i = test23 (a, b); + if (i != 0) + abort (); + i = test24 (a, b); + if (i != 1) + abort (); + i = test25 (a, b); + if (i != 1) + abort (); + i = test26 (a, b); + if (i != 1) + abort (); + i = test27 (a, b); + if (i != 1) + abort (); + i = test28 (a, b); + if (i != 1) + abort (); + i = test29 (a, b); + if (i != 1) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); + i = test32 (a, b); + if (i != 0) + abort (); + i = test33 (a, b); + if (i != 0) + abort (); + i = test34 (a, b); + if (i != 0) + abort (); + i = test35 (a, b); + if (i != 0) + abort (); + i = test36 (a, b); + if (i != 0) + abort (); + i = test37 (a, b); + if (i != 0) + abort (); + i = test38 (a, b); + if (i != 0) + abort (); + i = test39 (a, b); + if (i != 0) + abort (); + i = test40 (a, b); + if (i != 1) + abort (); + i = test41 (a, b); + if (i != 0) + abort (); + i = test42 (a, b); + if (i != 1) + abort (); + i = test43 (a, b); + if (i != 0) + abort (); + i = test44 (a, b); + if (i != 1) + abort (); + i = test45 (a, b); + if (i != 0) + abort (); + i = test46 (a, b); + if (i != 1) + abort (); + i = test47 (a, b); + if (i != 0) + abort (); + i = test48 (a, b); + if (i != 1) + abort (); + i = test49 (a, b); + if (i != 1) + abort (); + i = test50 (a, b); + if (i != 0) + abort (); + i = test51 (a, b); + if (i != 0) + abort (); + i = test52 (a, b); + if (i != 1) + abort (); + i = test53 (a, b); + if (i != 1) + abort (); + i = test54 (a, b); + if (i != 0) + abort (); + i = test55 (a, b); + if (i != 0) + abort (); + i = test56 (a, b); + if (i != 1) + abort (); + i = test57 (a, b); + if (i != 1) + abort (); + i = test58 (a, b); + if (i != 1) + abort (); + i = test59 (a, b); + if (i != 1) + abort (); + i = test60 (a, b); + if (i != 1) + abort (); + i = test61 (a, b); + if (i != 1) + abort (); + i = test62 (a, b); + if (i != 1) + abort (); + i = test63 (a, b); + if (i != 1) + abort (); + + /* Reverse arguments */ + i = test0 (b, a); + if (i != 0) + abort (); + i = test1 (b, a); + if (i != 0) + abort (); + i = test2 (b, a); + if (i != 0) + abort (); + i = test3 (b, a); + if (i != 0) + abort (); + i = test4 (b, a); + if (i != 0) + abort (); + i = test5 (b, a); + if (i != 0) + abort (); + i = test6 (b, a); + if (i != 0) + abort (); + i = test7 (b, a); + if (i != 0) + abort (); + i = test8 (b, a); + if (i != 1) + abort (); + i = test9 (b, a); + if (i != 0) + abort (); + i = test10 (b, a); + if (i != 1) + abort (); + i = test11 (b, a); + if (i != 0) + abort (); + i = test12 (b, a); + if (i != 1) + abort (); + i = test13 (b, a); + if (i != 0) + abort (); + i = test14 (b, a); + if (i != 1) + abort (); + i = test15 (b, a); + if (i != 0) + abort (); + i = test16 (b, a); + if (i != 0) + abort (); + i = test17 (b, a); + if (i != 0) + abort (); + i = test18 (b, a); + if (i != 0) + abort (); + i = test19 (b, a); + if (i != 0) + abort (); + i = test20 (b, a); + if (i != 0) + abort (); + i = test21 (b, a); + if (i != 0) + abort (); + i = test22 (b, a); + if (i != 0) + abort (); + i = test23 (b, a); + if (i != 0) + abort (); + i = test24 (b, a); + if (i != 1) + abort (); + i = test25 (b, a); + if (i != 0) + abort (); + i = test26 (b, a); + if (i != 1) + abort (); + i = test27 (b, a); + if (i != 0) + abort (); + i = test28 (b, a); + if (i != 1) + abort (); + i = test29 (b, a); + if (i != 0) + abort (); + i = test30 (b, a); + if (i != 1) + abort (); + i = test31 (b, a); + if (i != 0) + abort (); + i = test32 (b, a); + if (i != 0) + abort (); + i = test33 (b, a); + if (i != 0) + abort (); + i = test34 (b, a); + if (i != 0) + abort (); + i = test35 (b, a); + if (i != 0) + abort (); + i = test36 (b, a); + if (i != 0) + abort (); + i = test37 (b, a); + if (i != 0) + abort (); + i = test38 (b, a); + if (i != 0) + abort (); + i = test39 (b, a); + if (i != 0) + abort (); + i = test40 (b, a); + if (i != 1) + abort (); + i = test41 (b, a); + if (i != 0) + abort (); + i = test42 (b, a); + if (i != 1) + abort (); + i = test43 (b, a); + if (i != 0) + abort (); + i = test44 (b, a); + if (i != 1) + abort (); + i = test45 (b, a); + if (i != 0) + abort (); + i = test46 (b, a); + if (i != 1) + abort (); + i = test47 (b, a); + if (i != 0) + abort (); + i = test48 (b, a); + if (i != 0) + abort (); + i = test49 (b, a); + if (i != 0) + abort (); + i = test50 (b, a); + if (i != 0) + abort (); + i = test51 (b, a); + if (i != 0) + abort (); + i = test52 (b, a); + if (i != 0) + abort (); + i = test53 (b, a); + if (i != 0) + abort (); + i = test54 (b, a); + if (i != 0) + abort (); + i = test55 (b, a); + if (i != 0) + abort (); + i = test56 (b, a); + if (i != 1) + abort (); + i = test57 (b, a); + if (i != 0) + abort (); + i = test58 (b, a); + if (i != 1) + abort (); + i = test59 (b, a); + if (i != 0) + abort (); + i = test60 (b, a); + if (i != 1) + abort (); + i = test61 (b, a); + if (i != 0) + abort (); + i = test62 (b, a); + if (i != 1) + abort (); + i = test63 (b, a); + if (i != 0) + abort (); + +#ifndef __FAST_MATH__ + /* Test all comparisons */ + if (little_endian) + { + a = (v2sf) {qnan, qnan}; + b = (v2sf) {-1984.0, -567.345}; + } + else + { + a = (v2sf) {qnan, qnan}; + b = (v2sf) {-567.345, -1984.0}; + } + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 0) + abort (); + i = test4 (a, b); + if (i != 1) + abort (); + i = test5 (a, b); + if (i != 1) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 0) + abort (); + i = test11 (a, b); + if (i != 0) + abort (); + i = test12 (a, b); + if (i != 1) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + i = test16 (a, b); + if (i != 0) + abort (); + i = test17 (a, b); + if (i != 0) + abort (); + i = test18 (a, b); + if (i != 0) + abort (); + i = test19 (a, b); + if (i != 0) + abort (); + i = test20 (a, b); + if (i != 1) + abort (); + i = test21 (a, b); + if (i != 1) + abort (); + i = test22 (a, b); + if (i != 1) + abort (); + i = test23 (a, b); + if (i != 1) + abort (); + i = test24 (a, b); + if (i != 0) + abort (); + i = test25 (a, b); + if (i != 0) + abort (); + i = test26 (a, b); + if (i != 0) + abort (); + i = test27 (a, b); + if (i != 0) + abort (); + i = test28 (a, b); + if (i != 1) + abort (); + i = test29 (a, b); + if (i != 1) + abort (); + i = test30 (a, b); + if (i != 1) + abort (); + i = test31 (a, b); + if (i != 1) + abort (); + i = test32 (a, b); + if (i != 0) + abort (); + i = test33 (a, b); + if (i != 0) + abort (); + i = test34 (a, b); + if (i != 0) + abort (); + i = test35 (a, b); + if (i != 0) + abort (); + i = test36 (a, b); + if (i != 1) + abort (); + i = test37 (a, b); + if (i != 1) + abort (); + i = test38 (a, b); + if (i != 1) + abort (); + i = test39 (a, b); + if (i != 1) + abort (); + i = test40 (a, b); + if (i != 0) + abort (); + i = test41 (a, b); + if (i != 0) + abort (); + i = test42 (a, b); + if (i != 0) + abort (); + i = test43 (a, b); + if (i != 0) + abort (); + i = test44 (a, b); + if (i != 1) + abort (); + i = test45 (a, b); + if (i != 1) + abort (); + i = test46 (a, b); + if (i != 1) + abort (); + i = test47 (a, b); + if (i != 1) + abort (); + i = test48 (a, b); + if (i != 0) + abort (); + i = test49 (a, b); + if (i != 0) + abort (); + i = test50 (a, b); + if (i != 0) + abort (); + i = test51 (a, b); + if (i != 0) + abort (); + i = test52 (a, b); + if (i != 1) + abort (); + i = test53 (a, b); + if (i != 1) + abort (); + i = test54 (a, b); + if (i != 1) + abort (); + i = test55 (a, b); + if (i != 1) + abort (); + i = test56 (a, b); + if (i != 0) + abort (); + i = test57 (a, b); + if (i != 0) + abort (); + i = test58 (a, b); + if (i != 0) + abort (); + i = test59 (a, b); + if (i != 0) + abort (); + i = test60 (a, b); + if (i != 1) + abort (); + i = test61 (a, b); + if (i != 1) + abort (); + i = test62 (a, b); + if (i != 1) + abort (); + i = test63 (a, b); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_f_ps (a, b); +} + +int test1 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_f_ps (a, b); +} + +int test2 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_f_ps (a, b); +} + +int test3 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_f_ps (a, b); +} + +int test4 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_un_ps (a, b); +} + +int test5 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_un_ps (a, b); +} + +int test6 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_un_ps (a, b); +} + +int test7 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_un_ps (a, b); +} + +int test8 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_eq_ps (a, b); +} + +int test9 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_eq_ps (a, b); +} + +int test10 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_eq_ps (a, b); +} + +int test11 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_eq_ps (a, b); +} + +int test12 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ueq_ps (a, b); +} + +int test13 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ueq_ps (a, b); +} + +int test14 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ueq_ps (a, b); +} + +int test15 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ueq_ps (a, b); +} + +int test16 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_olt_ps (a, b); +} + +int test17 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_olt_ps (a, b); +} + +int test18 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_olt_ps (a, b); +} + +int test19 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_olt_ps (a, b); +} + +int test20 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ult_ps (a, b); +} + +int test21 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ult_ps (a, b); +} + +int test22 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ult_ps (a, b); +} + +int test23 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ult_ps (a, b); +} + +int test24 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ole_ps (a, b); +} + +int test25 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ole_ps (a, b); +} + +int test26 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ole_ps (a, b); +} + +int test27 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ole_ps (a, b); +} + +int test28 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ule_ps (a, b); +} + +int test29 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ule_ps (a, b); +} + +int test30 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ule_ps (a, b); +} + +int test31 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ule_ps (a, b); +} + +int test32 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_sf_ps (a, b); +} + +int test33 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_sf_ps (a, b); +} + +int test34 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_sf_ps (a, b); +} + +int test35 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_sf_ps (a, b); +} + +int test36 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ngle_ps (a, b); +} + +int test37 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ngle_ps (a, b); +} + +int test38 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ngle_ps (a, b); +} + +int test39 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ngle_ps (a, b); +} + +int test40 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_seq_ps (a, b); +} + +int test41 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_seq_ps (a, b); +} + +int test42 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_seq_ps (a, b); +} + +int test43 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_seq_ps (a, b); +} + +int test44 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ngl_ps (a, b); +} + +int test45 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ngl_ps (a, b); +} + +int test46 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ngl_ps (a, b); +} + +int test47 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ngl_ps (a, b); +} + +int test48 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_lt_ps (a, b); +} + +int test49 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_lt_ps (a, b); +} + +int test50 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_lt_ps (a, b); +} + +int test51 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_lt_ps (a, b); +} + +int test52 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_nge_ps (a, b); +} + +int test53 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_nge_ps (a, b); +} + +int test54 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_nge_ps (a, b); +} + +int test55 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_nge_ps (a, b); +} + +int test56 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_le_ps (a, b); +} + +int test57 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_le_ps (a, b); +} + +int test58 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_le_ps (a, b); +} + +int test59 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_le_ps (a, b); +} + +int test60 (v2sf a, v2sf b) +{ + return __builtin_mips_any_cabs_ngt_ps (a, b); +} + +int test61 (v2sf a, v2sf b) +{ + return __builtin_mips_upper_cabs_ngt_ps (a, b); +} + +int test62 (v2sf a, v2sf b) +{ + return __builtin_mips_lower_cabs_ngt_ps (a, b); +} + +int test63 (v2sf a, v2sf b) +{ + return __builtin_mips_all_cabs_ngt_ps (a, b); +}
mips-3d-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-4.c =================================================================== --- mips-3d-4.c (nonexistent) +++ mips-3d-4.c (revision 154) @@ -0,0 +1,590 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D branch-if-any-four builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int test0 (v2sf a, v2sf b, v2sf c, v2sf d); +int test1 (v2sf a, v2sf b, v2sf c, v2sf d); +int test2 (v2sf a, v2sf b, v2sf c, v2sf d); +int test3 (v2sf a, v2sf b, v2sf c, v2sf d); +int test4 (v2sf a, v2sf b, v2sf c, v2sf d); +int test5 (v2sf a, v2sf b, v2sf c, v2sf d); +int test6 (v2sf a, v2sf b, v2sf c, v2sf d); +int test7 (v2sf a, v2sf b, v2sf c, v2sf d); +int test8 (v2sf a, v2sf b, v2sf c, v2sf d); +int test9 (v2sf a, v2sf b, v2sf c, v2sf d); +int test10 (v2sf a, v2sf b, v2sf c, v2sf d); +int test11 (v2sf a, v2sf b, v2sf c, v2sf d); +int test12 (v2sf a, v2sf b, v2sf c, v2sf d); +int test13 (v2sf a, v2sf b, v2sf c, v2sf d); +int test14 (v2sf a, v2sf b, v2sf c, v2sf d); +int test15 (v2sf a, v2sf b, v2sf c, v2sf d); +int test16 (v2sf a, v2sf b, v2sf c, v2sf d); +int test17 (v2sf a, v2sf b, v2sf c, v2sf d); +int test18 (v2sf a, v2sf b, v2sf c, v2sf d); +int test19 (v2sf a, v2sf b, v2sf c, v2sf d); +int test20 (v2sf a, v2sf b, v2sf c, v2sf d); +int test21 (v2sf a, v2sf b, v2sf c, v2sf d); +int test22 (v2sf a, v2sf b, v2sf c, v2sf d); +int test23 (v2sf a, v2sf b, v2sf c, v2sf d); +int test24 (v2sf a, v2sf b, v2sf c, v2sf d); +int test25 (v2sf a, v2sf b, v2sf c, v2sf d); +int test26 (v2sf a, v2sf b, v2sf c, v2sf d); +int test27 (v2sf a, v2sf b, v2sf c, v2sf d); +int test28 (v2sf a, v2sf b, v2sf c, v2sf d); +int test29 (v2sf a, v2sf b, v2sf c, v2sf d); +int test30 (v2sf a, v2sf b, v2sf c, v2sf d); +int test31 (v2sf a, v2sf b, v2sf c, v2sf d); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + v2sf a, b, c, d; + int i, j; + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {33, 44}; + c = (v2sf) {55, 66}; + d = (v2sf) {77, 88}; + i = 0; + j = 0; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {11, 44}; + c = (v2sf) {55, 66}; + d = (v2sf) {77, 88}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {33, 22}; + c = (v2sf) {55, 66}; + d = (v2sf) {77, 88}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {33, 44}; + c = (v2sf) {55, 66}; + d = (v2sf) {55, 88}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {33, 44}; + c = (v2sf) {55, 66}; + d = (v2sf) {77, 66}; + i = 1; + j = 0; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* c.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {11, 22}; + c = (v2sf) {55, 66}; + d = (v2sf) {55, 66}; + i = 1; + j = 1; + if (__builtin_mips_any_c_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_c_eq_4s(a, b, c, d) != j) + abort (); + + /* Test all comparisons */ + a = (v2sf) {11, 33}; + b = (v2sf) {33, 11}; + c = (v2sf) {55, 66}; + d = (v2sf) {55, 88}; + + i = test0 (a, b, c, d); + if (i != 0) + abort (); + i = test1 (a, b, c, d); + if (i != 0) + abort (); + i = test2 (a, b, c, d); + if (i != 0) + abort (); + i = test3 (a, b, c, d); + if (i != 0) + abort (); + i = test4 (a, b, c, d); + if (i != 1) + abort (); + i = test5 (a, b, c, d); + if (i != 0) + abort (); + i = test6 (a, b, c, d); + if (i != 1) + abort (); + i = test7 (a, b, c, d); + if (i != 0) + abort (); + i = test8 (a, b, c, d); + if (i != 1) + abort (); + i = test9 (a, b, c, d); + if (i != 0) + abort (); + i = test10 (a, b, c, d); + if (i != 1) + abort (); + i = test11 (a, b, c, d); + if (i != 0) + abort (); + i = test12 (a, b, c, d); + if (i != 1) + abort (); + i = test13 (a, b, c, d); + if (i != 0) + abort (); + i = test14 (a, b, c, d); + if (i != 1) + abort (); + i = test15 (a, b, c, d); + if (i != 0) + abort (); + i = test16 (a, b, c, d); + if (i != 0) + abort (); + i = test17 (a, b, c, d); + if (i != 0) + abort (); + i = test18 (a, b, c, d); + if (i != 0) + abort (); + i = test19 (a, b, c, d); + if (i != 0) + abort (); + i = test20 (a, b, c, d); + if (i != 1) + abort (); + i = test21 (a, b, c, d); + if (i != 0) + abort (); + i = test22 (a, b, c, d); + if (i != 1) + abort (); + i = test23 (a, b, c, d); + if (i != 0) + abort (); + i = test24 (a, b, c, d); + if (i != 1) + abort (); + i = test25 (a, b, c, d); + if (i != 0) + abort (); + i = test26 (a, b, c, d); + if (i != 1) + abort (); + i = test27 (a, b, c, d); + if (i != 0) + abort (); + i = test28 (a, b, c, d); + if (i != 1) + abort (); + i = test29 (a, b, c, d); + if (i != 0) + abort (); + i = test30 (a, b, c, d); + if (i != 1) + abort (); + i = test31 (a, b, c, d); + if (i != 0) + abort (); + + /* Reversed arguments */ + i = test0 (b, a, d, c); + if (i != 0) + abort (); + i = test1 (b, a, d, c); + if (i != 0) + abort (); + i = test2 (b, a, d, c); + if (i != 0) + abort (); + i = test3 (b, a, d, c); + if (i != 0) + abort (); + i = test4 (b, a, d, c); + if (i != 1) + abort (); + i = test5 (b, a, d, c); + if (i != 0) + abort (); + i = test6 (b, a, d, c); + if (i != 1) + abort (); + i = test7 (b, a, d, c); + if (i != 0) + abort (); + i = test8 (b, a, d, c); + if (i != 1) + abort (); + i = test9 (b, a, d, c); + if (i != 0) + abort (); + i = test10 (b, a, d, c); + if (i != 1) + abort (); + i = test11 (b, a, d, c); + if (i != 0) + abort (); + i = test12 (b, a, d, c); + if (i != 1) + abort (); + i = test13 (b, a, d, c); + if (i != 0) + abort (); + i = test14 (b, a, d, c); + if (i != 1) + abort (); + i = test15 (b, a, d, c); + if (i != 0) + abort (); + i = test16 (b, a, d, c); + if (i != 0) + abort (); + i = test17 (b, a, d, c); + if (i != 0) + abort (); + i = test18 (b, a, d, c); + if (i != 0) + abort (); + i = test19 (b, a, d, c); + if (i != 0) + abort (); + i = test20 (b, a, d, c); + if (i != 1) + abort (); + i = test21 (b, a, d, c); + if (i != 0) + abort (); + i = test22 (b, a, d, c); + if (i != 1) + abort (); + i = test23 (b, a, d, c); + if (i != 0) + abort (); + i = test24 (b, a, d, c); + if (i != 1) + abort (); + i = test25 (b, a, d, c); + if (i != 0) + abort (); + i = test26 (b, a, d, c); + if (i != 1) + abort (); + i = test27 (b, a, d, c); + if (i != 0) + abort (); + i = test28 (b, a, d, c); + if (i != 1) + abort (); + i = test29 (b, a, d, c); + if (i != 0) + abort (); + i = test30 (b, a, d, c); + if (i != 1) + abort (); + i = test31 (b, a, d, c); + if (i != 0) + abort (); + +#ifndef __FAST_MATH__ + /* Test all comparisons */ + a = (v2sf) {qnan, qnan}; + b = (v2sf) {33, 11}; + c = (v2sf) {qnan, qnan}; + d = (v2sf) {55, 88}; + + i = test0 (a, b, c, d); + if (i != 0) + abort (); + i = test1 (a, b, c, d); + if (i != 0) + abort (); + i = test2 (a, b, c, d); + if (i != 1) + abort (); + i = test3 (a, b, c, d); + if (i != 1) + abort (); + i = test4 (a, b, c, d); + if (i != 0) + abort (); + i = test5 (a, b, c, d); + if (i != 0) + abort (); + i = test6 (a, b, c, d); + if (i != 1) + abort (); + i = test7 (a, b, c, d); + if (i != 1) + abort (); + i = test8 (a, b, c, d); + if (i != 0) + abort (); + i = test9 (a, b, c, d); + if (i != 0) + abort (); + i = test10 (a, b, c, d); + if (i != 1) + abort (); + i = test11 (a, b, c, d); + if (i != 1) + abort (); + i = test12 (a, b, c, d); + if (i != 0) + abort (); + i = test13 (a, b, c, d); + if (i != 0) + abort (); + i = test14 (a, b, c, d); + if (i != 1) + abort (); + i = test15 (a, b, c, d); + if (i != 1) + abort (); + i = test16 (a, b, c, d); + if (i != 0) + abort (); + i = test17 (a, b, c, d); + if (i != 0) + abort (); + i = test18 (a, b, c, d); + if (i != 1) + abort (); + i = test19 (a, b, c, d); + if (i != 1) + abort (); + i = test20 (a, b, c, d); + if (i != 0) + abort (); + i = test21 (a, b, c, d); + if (i != 0) + abort (); + i = test22 (a, b, c, d); + if (i != 1) + abort (); + i = test23 (a, b, c, d); + if (i != 1) + abort (); + i = test24 (a, b, c, d); + if (i != 0) + abort (); + i = test25 (a, b, c, d); + if (i != 0) + abort (); + i = test26 (a, b, c, d); + if (i != 1) + abort (); + i = test27 (a, b, c, d); + if (i != 1) + abort (); + i = test28 (a, b, c, d); + if (i != 0) + abort (); + i = test29 (a, b, c, d); + if (i != 0) + abort (); + i = test30 (a, b, c, d); + if (i != 1) + abort (); + i = test31 (a, b, c, d); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_f_4s (a, b, c, d); +} + +int test1 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_f_4s (a, b, c, d); +} + +int test2 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_un_4s (a, b, c, d); +} + +int test3 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_un_4s (a, b, c, d); +} + +int test4 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_eq_4s (a, b, c, d); +} + +int test5 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_eq_4s (a, b, c, d); +} + +int test6 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ueq_4s (a, b, c, d); +} + +int test7 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ueq_4s (a, b, c, d); +} + +int test8 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_olt_4s (a, b, c, d); +} + +int test9 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_olt_4s (a, b, c, d); +} + +int test10 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ult_4s (a, b, c, d); +} + +int test11 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ult_4s (a, b, c, d); +} + +int test12 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ole_4s (a, b, c, d); +} + +int test13 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ole_4s (a, b, c, d); +} + +int test14 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ule_4s (a, b, c, d); +} + +int test15 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ule_4s (a, b, c, d); +} + +int test16 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_sf_4s (a, b, c, d); +} + +int test17 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_sf_4s (a, b, c, d); +} + +int test18 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ngle_4s (a, b, c, d); +} + +int test19 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ngle_4s (a, b, c, d); +} + +int test20 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_seq_4s (a, b, c, d); +} + +int test21 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_seq_4s (a, b, c, d); +} + +int test22 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ngl_4s (a, b, c, d); +} + +int test23 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ngl_4s (a, b, c, d); +} + +int test24 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_lt_4s (a, b, c, d); +} + +int test25 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_lt_4s (a, b, c, d); +} + +int test26 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_nge_4s (a, b, c, d); +} + +int test27 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_nge_4s (a, b, c, d); +} + +int test28 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_le_4s (a, b, c, d); +} + +int test29 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_le_4s (a, b, c, d); +} + +int test30 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_c_ngt_4s (a, b, c, d); +} + +int test31 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_c_ngt_4s (a, b, c, d); +}
mips-3d-4.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: asm-1.c =================================================================== --- asm-1.c (nonexistent) +++ asm-1.c (revision 154) @@ -0,0 +1,14 @@ +/* PR target/17565. GCC used to put the asm into the delay slot + of the call. */ +/* { dg-do assemble } */ +/* { dg-mips-options "-O -mno-mips16" } */ +int foo (int n) +{ + register int k asm ("$16") = n; + if (k > 0) + { + bar (); + asm ("li %0,0x12345678" : "=r" (k)); + } + return k; +}
asm-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-5.c =================================================================== --- mips-3d-5.c (nonexistent) +++ mips-3d-5.c (revision 154) @@ -0,0 +1,590 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */ +#include +#include + +typedef float v2sf __attribute__ ((vector_size(8))); + +int test0 (v2sf a, v2sf b, v2sf c, v2sf d); +int test1 (v2sf a, v2sf b, v2sf c, v2sf d); +int test2 (v2sf a, v2sf b, v2sf c, v2sf d); +int test3 (v2sf a, v2sf b, v2sf c, v2sf d); +int test4 (v2sf a, v2sf b, v2sf c, v2sf d); +int test5 (v2sf a, v2sf b, v2sf c, v2sf d); +int test6 (v2sf a, v2sf b, v2sf c, v2sf d); +int test7 (v2sf a, v2sf b, v2sf c, v2sf d); +int test8 (v2sf a, v2sf b, v2sf c, v2sf d); +int test9 (v2sf a, v2sf b, v2sf c, v2sf d); +int test10 (v2sf a, v2sf b, v2sf c, v2sf d); +int test11 (v2sf a, v2sf b, v2sf c, v2sf d); +int test12 (v2sf a, v2sf b, v2sf c, v2sf d); +int test13 (v2sf a, v2sf b, v2sf c, v2sf d); +int test14 (v2sf a, v2sf b, v2sf c, v2sf d); +int test15 (v2sf a, v2sf b, v2sf c, v2sf d); +int test16 (v2sf a, v2sf b, v2sf c, v2sf d); +int test17 (v2sf a, v2sf b, v2sf c, v2sf d); +int test18 (v2sf a, v2sf b, v2sf c, v2sf d); +int test19 (v2sf a, v2sf b, v2sf c, v2sf d); +int test20 (v2sf a, v2sf b, v2sf c, v2sf d); +int test21 (v2sf a, v2sf b, v2sf c, v2sf d); +int test22 (v2sf a, v2sf b, v2sf c, v2sf d); +int test23 (v2sf a, v2sf b, v2sf c, v2sf d); +int test24 (v2sf a, v2sf b, v2sf c, v2sf d); +int test25 (v2sf a, v2sf b, v2sf c, v2sf d); +int test26 (v2sf a, v2sf b, v2sf c, v2sf d); +int test27 (v2sf a, v2sf b, v2sf c, v2sf d); +int test28 (v2sf a, v2sf b, v2sf c, v2sf d); +int test29 (v2sf a, v2sf b, v2sf c, v2sf d); +int test30 (v2sf a, v2sf b, v2sf c, v2sf d); +int test31 (v2sf a, v2sf b, v2sf c, v2sf d); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + v2sf a, b, c, d; + int i, j; + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-33, -44}; + c = (v2sf) {55, 66}; + d = (v2sf) {-77, -88}; + i = 0; + j = 0; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-11, -44}; + c = (v2sf) {55, 66}; + d = (v2sf) {-77, -88}; + i = 1; + j = 0; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-33, -22}; + c = (v2sf) {55, 66}; + d = (v2sf) {-77, -88}; + i = 1; + j = 0; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-33, -44}; + c = (v2sf) {55, 66}; + d = (v2sf) {-55, -88}; + i = 1; + j = 0; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-33, -44}; + c = (v2sf) {55, 66}; + d = (v2sf) {-77, -66}; + i = 1; + j = 0; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* cabs.eq.ps */ + a = (v2sf) {11, 22}; + b = (v2sf) {-11, -22}; + c = (v2sf) {55, 66}; + d = (v2sf) {-55, -66}; + i = 1; + j = 1; + if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) + abort (); + if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) + abort (); + + /* Test all comparisons */ + a = (v2sf) {11, 33}; + b = (v2sf) {-33, -11}; + c = (v2sf) {55, 66}; + d = (v2sf) {-55, -88}; + + i = test0 (a, b, c, d); + if (i != 0) + abort (); + i = test1 (a, b, c, d); + if (i != 0) + abort (); + i = test2 (a, b, c, d); + if (i != 0) + abort (); + i = test3 (a, b, c, d); + if (i != 0) + abort (); + i = test4 (a, b, c, d); + if (i != 1) + abort (); + i = test5 (a, b, c, d); + if (i != 0) + abort (); + i = test6 (a, b, c, d); + if (i != 1) + abort (); + i = test7 (a, b, c, d); + if (i != 0) + abort (); + i = test8 (a, b, c, d); + if (i != 1) + abort (); + i = test9 (a, b, c, d); + if (i != 0) + abort (); + i = test10 (a, b, c, d); + if (i != 1) + abort (); + i = test11 (a, b, c, d); + if (i != 0) + abort (); + i = test12 (a, b, c, d); + if (i != 1) + abort (); + i = test13 (a, b, c, d); + if (i != 0) + abort (); + i = test14 (a, b, c, d); + if (i != 1) + abort (); + i = test15 (a, b, c, d); + if (i != 0) + abort (); + i = test16 (a, b, c, d); + if (i != 0) + abort (); + i = test17 (a, b, c, d); + if (i != 0) + abort (); + i = test18 (a, b, c, d); + if (i != 0) + abort (); + i = test19 (a, b, c, d); + if (i != 0) + abort (); + i = test20 (a, b, c, d); + if (i != 1) + abort (); + i = test21 (a, b, c, d); + if (i != 0) + abort (); + i = test22 (a, b, c, d); + if (i != 1) + abort (); + i = test23 (a, b, c, d); + if (i != 0) + abort (); + i = test24 (a, b, c, d); + if (i != 1) + abort (); + i = test25 (a, b, c, d); + if (i != 0) + abort (); + i = test26 (a, b, c, d); + if (i != 1) + abort (); + i = test27 (a, b, c, d); + if (i != 0) + abort (); + i = test28 (a, b, c, d); + if (i != 1) + abort (); + i = test29 (a, b, c, d); + if (i != 0) + abort (); + i = test30 (a, b, c, d); + if (i != 1) + abort (); + i = test31 (a, b, c, d); + if (i != 0) + abort (); + + /* Reversed arguments */ + i = test0 (b, a, d, c); + if (i != 0) + abort (); + i = test1 (b, a, d, c); + if (i != 0) + abort (); + i = test2 (b, a, d, c); + if (i != 0) + abort (); + i = test3 (b, a, d, c); + if (i != 0) + abort (); + i = test4 (b, a, d, c); + if (i != 1) + abort (); + i = test5 (b, a, d, c); + if (i != 0) + abort (); + i = test6 (b, a, d, c); + if (i != 1) + abort (); + i = test7 (b, a, d, c); + if (i != 0) + abort (); + i = test8 (b, a, d, c); + if (i != 1) + abort (); + i = test9 (b, a, d, c); + if (i != 0) + abort (); + i = test10 (b, a, d, c); + if (i != 1) + abort (); + i = test11 (b, a, d, c); + if (i != 0) + abort (); + i = test12 (b, a, d, c); + if (i != 1) + abort (); + i = test13 (b, a, d, c); + if (i != 0) + abort (); + i = test14 (b, a, d, c); + if (i != 1) + abort (); + i = test15 (b, a, d, c); + if (i != 0) + abort (); + i = test16 (b, a, d, c); + if (i != 0) + abort (); + i = test17 (b, a, d, c); + if (i != 0) + abort (); + i = test18 (b, a, d, c); + if (i != 0) + abort (); + i = test19 (b, a, d, c); + if (i != 0) + abort (); + i = test20 (b, a, d, c); + if (i != 1) + abort (); + i = test21 (b, a, d, c); + if (i != 0) + abort (); + i = test22 (b, a, d, c); + if (i != 1) + abort (); + i = test23 (b, a, d, c); + if (i != 0) + abort (); + i = test24 (b, a, d, c); + if (i != 1) + abort (); + i = test25 (b, a, d, c); + if (i != 0) + abort (); + i = test26 (b, a, d, c); + if (i != 1) + abort (); + i = test27 (b, a, d, c); + if (i != 0) + abort (); + i = test28 (b, a, d, c); + if (i != 1) + abort (); + i = test29 (b, a, d, c); + if (i != 0) + abort (); + i = test30 (b, a, d, c); + if (i != 1) + abort (); + i = test31 (b, a, d, c); + if (i != 0) + abort (); + +#ifndef __FAST_MATH__ + /* Test all comparisons */ + a = (v2sf) {qnan, qnan}; + b = (v2sf) {-33, -11}; + c = (v2sf) {qnan, qnan}; + d = (v2sf) {-55, -88}; + + i = test0 (a, b, c, d); + if (i != 0) + abort (); + i = test1 (a, b, c, d); + if (i != 0) + abort (); + i = test2 (a, b, c, d); + if (i != 1) + abort (); + i = test3 (a, b, c, d); + if (i != 1) + abort (); + i = test4 (a, b, c, d); + if (i != 0) + abort (); + i = test5 (a, b, c, d); + if (i != 0) + abort (); + i = test6 (a, b, c, d); + if (i != 1) + abort (); + i = test7 (a, b, c, d); + if (i != 1) + abort (); + i = test8 (a, b, c, d); + if (i != 0) + abort (); + i = test9 (a, b, c, d); + if (i != 0) + abort (); + i = test10 (a, b, c, d); + if (i != 1) + abort (); + i = test11 (a, b, c, d); + if (i != 1) + abort (); + i = test12 (a, b, c, d); + if (i != 0) + abort (); + i = test13 (a, b, c, d); + if (i != 0) + abort (); + i = test14 (a, b, c, d); + if (i != 1) + abort (); + i = test15 (a, b, c, d); + if (i != 1) + abort (); + i = test16 (a, b, c, d); + if (i != 0) + abort (); + i = test17 (a, b, c, d); + if (i != 0) + abort (); + i = test18 (a, b, c, d); + if (i != 1) + abort (); + i = test19 (a, b, c, d); + if (i != 1) + abort (); + i = test20 (a, b, c, d); + if (i != 0) + abort (); + i = test21 (a, b, c, d); + if (i != 0) + abort (); + i = test22 (a, b, c, d); + if (i != 1) + abort (); + i = test23 (a, b, c, d); + if (i != 1) + abort (); + i = test24 (a, b, c, d); + if (i != 0) + abort (); + i = test25 (a, b, c, d); + if (i != 0) + abort (); + i = test26 (a, b, c, d); + if (i != 1) + abort (); + i = test27 (a, b, c, d); + if (i != 1) + abort (); + i = test28 (a, b, c, d); + if (i != 0) + abort (); + i = test29 (a, b, c, d); + if (i != 0) + abort (); + i = test30 (a, b, c, d); + if (i != 1) + abort (); + i = test31 (a, b, c, d); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_f_4s (a, b, c, d); +} + +int test1 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_f_4s (a, b, c, d); +} + +int test2 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_un_4s (a, b, c, d); +} + +int test3 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_un_4s (a, b, c, d); +} + +int test4 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_eq_4s (a, b, c, d); +} + +int test5 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_eq_4s (a, b, c, d); +} + +int test6 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ueq_4s (a, b, c, d); +} + +int test7 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ueq_4s (a, b, c, d); +} + +int test8 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_olt_4s (a, b, c, d); +} + +int test9 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_olt_4s (a, b, c, d); +} + +int test10 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ult_4s (a, b, c, d); +} + +int test11 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ult_4s (a, b, c, d); +} + +int test12 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ole_4s (a, b, c, d); +} + +int test13 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ole_4s (a, b, c, d); +} + +int test14 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ule_4s (a, b, c, d); +} + +int test15 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ule_4s (a, b, c, d); +} + +int test16 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_sf_4s (a, b, c, d); +} + +int test17 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_sf_4s (a, b, c, d); +} + +int test18 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ngle_4s (a, b, c, d); +} + +int test19 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ngle_4s (a, b, c, d); +} + +int test20 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_seq_4s (a, b, c, d); +} + +int test21 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_seq_4s (a, b, c, d); +} + +int test22 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ngl_4s (a, b, c, d); +} + +int test23 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ngl_4s (a, b, c, d); +} + +int test24 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_lt_4s (a, b, c, d); +} + +int test25 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_lt_4s (a, b, c, d); +} + +int test26 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_nge_4s (a, b, c, d); +} + +int test27 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_nge_4s (a, b, c, d); +} + +int test28 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_le_4s (a, b, c, d); +} + +int test29 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_le_4s (a, b, c, d); +} + +int test30 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_any_cabs_ngt_4s (a, b, c, d); +} + +int test31 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_all_cabs_ngt_4s (a, b, c, d); +}
mips-3d-5.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-6.c =================================================================== --- mips-3d-6.c (nonexistent) +++ mips-3d-6.c (revision 154) @@ -0,0 +1,284 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D absolute compare (floats) builtin functions */ +#include +#include + +int test0 (float a, float b); +int test1 (float a, float b); +int test2 (float a, float b); +int test3 (float a, float b); +int test4 (float a, float b); +int test5 (float a, float b); +int test6 (float a, float b); +int test7 (float a, float b); +int test8 (float a, float b); +int test9 (float a, float b); +int test10 (float a, float b); +int test11 (float a, float b); +int test12 (float a, float b); +int test13 (float a, float b); +int test14 (float a, float b); +int test15 (float a, float b); + +int main () +{ + float a, b; + int i; + + /* cabs.eq.s */ + a = 12; + b = -56; + i = 0; + if (__builtin_mips_cabs_eq_s(a, b) != i) + abort (); + + /* cabs.eq.s */ + a = 12; + b = -12; + i = 1; + if (__builtin_mips_cabs_eq_s(a, b) != i) + abort (); + + /* Test all comparisons */ + a = 10.58; + b = 567.345; + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 0) + abort (); + i = test4 (a, b); + if (i != 1) + abort (); + i = test5 (a, b); + if (i != 1) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 0) + abort (); + i = test11 (a, b); + if (i != 0) + abort (); + i = test12 (a, b); + if (i != 1) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + + /* Reversed arguments */ + i = test0 (b, a); + if (i != 0) + abort (); + i = test1 (b, a); + if (i != 0) + abort (); + i = test2 (b, a); + if (i != 0) + abort (); + i = test3 (b, a); + if (i != 0) + abort (); + i = test4 (b, a); + if (i != 0) + abort (); + i = test5 (b, a); + if (i != 0) + abort (); + i = test6 (b, a); + if (i != 0) + abort (); + i = test7 (b, a); + if (i != 0) + abort (); + i = test8 (b, a); + if (i != 0) + abort (); + i = test9 (b, a); + if (i != 0) + abort (); + i = test10 (b, a); + if (i != 0) + abort (); + i = test11 (b, a); + if (i != 0) + abort (); + i = test12 (b, a); + if (i != 0) + abort (); + i = test13 (b, a); + if (i != 0) + abort (); + i = test14 (b, a); + if (i != 0) + abort (); + i = test15 (b, a); + if (i != 0) + abort (); + +#ifndef __FAST_MATH__ + /* Test all comparisons */ + a = 1.0f/0.0f - 1.0f/0.0f; // QNaN + b = 567.345; + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 1) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 1) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 1) + abort (); + i = test6 (a, b); + if (i != 0) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 1) + abort (); + i = test10 (a, b); + if (i != 0) + abort (); + i = test11 (a, b); + if (i != 1) + abort (); + i = test12 (a, b); + if (i != 0) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 0) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (float a, float b) +{ + return __builtin_mips_cabs_f_s (a, b); +} + +int test1 (float a, float b) +{ + return __builtin_mips_cabs_un_s (a, b); +} + +int test2 (float a, float b) +{ + return __builtin_mips_cabs_eq_s (a, b); +} + +int test3 (float a, float b) +{ + return __builtin_mips_cabs_ueq_s (a, b); +} + +int test4 (float a, float b) +{ + return __builtin_mips_cabs_olt_s (a, b); +} + +int test5 (float a, float b) +{ + return __builtin_mips_cabs_ult_s (a, b); +} + +int test6 (float a, float b) +{ + return __builtin_mips_cabs_ole_s (a, b); +} + +int test7 (float a, float b) +{ + return __builtin_mips_cabs_ule_s (a, b); +} + +int test8 (float a, float b) +{ + return __builtin_mips_cabs_sf_s (a, b); +} + +int test9 (float a, float b) +{ + return __builtin_mips_cabs_ngle_s (a, b); +} + +int test10 (float a, float b) +{ + return __builtin_mips_cabs_seq_s (a, b); +} + +int test11 (float a, float b) +{ + return __builtin_mips_cabs_ngl_s (a, b); +} + +int test12 (float a, float b) +{ + return __builtin_mips_cabs_lt_s (a, b); +} + +int test13 (float a, float b) +{ + return __builtin_mips_cabs_nge_s (a, b); +} + +int test14 (float a, float b) +{ + return __builtin_mips_cabs_le_s (a, b); +} + +int test15 (float a, float b) +{ + return __builtin_mips_cabs_ngt_s (a, b); +}
mips-3d-6.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-7.c =================================================================== --- mips-3d-7.c (nonexistent) +++ mips-3d-7.c (revision 154) @@ -0,0 +1,284 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D absolute compare (doubles) builtin functions */ +#include +#include + +int test0 (double a, double b); +int test1 (double a, double b); +int test2 (double a, double b); +int test3 (double a, double b); +int test4 (double a, double b); +int test5 (double a, double b); +int test6 (double a, double b); +int test7 (double a, double b); +int test8 (double a, double b); +int test9 (double a, double b); +int test10 (double a, double b); +int test11 (double a, double b); +int test12 (double a, double b); +int test13 (double a, double b); +int test14 (double a, double b); +int test15 (double a, double b); + +int main () +{ + double a, b; + int i; + + /* cabs.eq.d */ + a = 12; + b = -56; + i = 0; + if (__builtin_mips_cabs_eq_d(a, b) != i) + abort (); + + /* cabs.eq.d */ + a = 12; + b = -12; + i = 1; + if (__builtin_mips_cabs_eq_d(a, b) != i) + abort (); + + /* Test all operators */ + a = 1984.0; + b = 1984.0; + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 0) + abort (); + i = test2 (a, b); + if (i != 1) + abort (); + i = test3 (a, b); + if (i != 1) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 0) + abort (); + i = test6 (a, b); + if (i != 1) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 0) + abort (); + i = test10 (a, b); + if (i != 1) + abort (); + i = test11 (a, b); + if (i != 1) + abort (); + i = test12 (a, b); + if (i != 0) + abort (); + i = test13 (a, b); + if (i != 0) + abort (); + i = test14 (a, b); + if (i != 1) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); + + /* Reverse arguments */ + i = test0 (b, a); + if (i != 0) + abort (); + i = test1 (b, a); + if (i != 0) + abort (); + i = test2 (b, a); + if (i != 1) + abort (); + i = test3 (b, a); + if (i != 1) + abort (); + i = test4 (b, a); + if (i != 0) + abort (); + i = test5 (b, a); + if (i != 0) + abort (); + i = test6 (b, a); + if (i != 1) + abort (); + i = test7 (b, a); + if (i != 1) + abort (); + i = test8 (b, a); + if (i != 0) + abort (); + i = test9 (b, a); + if (i != 0) + abort (); + i = test10 (b, a); + if (i != 1) + abort (); + i = test11 (b, a); + if (i != 1) + abort (); + i = test12 (b, a); + if (i != 0) + abort (); + i = test13 (b, a); + if (i != 0) + abort (); + i = test14 (b, a); + if (i != 1) + abort (); + i = test15 (b, a); + if (i != 1) + abort (); + +#ifndef __FAST_MATH__ + /* Test all operators */ + a = 1.0/0.0 - 1.0/0.0; // QNaN + b = 1.0/0.0 - 1.0/0.0; // QNaN + + i = test0 (a, b); + if (i != 0) + abort (); + i = test1 (a, b); + if (i != 1) + abort (); + i = test2 (a, b); + if (i != 0) + abort (); + i = test3 (a, b); + if (i != 1) + abort (); + i = test4 (a, b); + if (i != 0) + abort (); + i = test5 (a, b); + if (i != 1) + abort (); + i = test6 (a, b); + if (i != 0) + abort (); + i = test7 (a, b); + if (i != 1) + abort (); + i = test8 (a, b); + if (i != 0) + abort (); + i = test9 (a, b); + if (i != 1) + abort (); + i = test10 (a, b); + if (i != 0) + abort (); + i = test11 (a, b); + if (i != 1) + abort (); + i = test12 (a, b); + if (i != 0) + abort (); + i = test13 (a, b); + if (i != 1) + abort (); + i = test14 (a, b); + if (i != 0) + abort (); + i = test15 (a, b); + if (i != 1) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +int test0 (double a, double b) +{ + return __builtin_mips_cabs_f_d (a, b); +} + +int test1 (double a, double b) +{ + return __builtin_mips_cabs_un_d (a, b); +} + +int test2 (double a, double b) +{ + return __builtin_mips_cabs_eq_d (a, b); +} + +int test3 (double a, double b) +{ + return __builtin_mips_cabs_ueq_d (a, b); +} + +int test4 (double a, double b) +{ + return __builtin_mips_cabs_olt_d (a, b); +} + +int test5 (double a, double b) +{ + return __builtin_mips_cabs_ult_d (a, b); +} + +int test6 (double a, double b) +{ + return __builtin_mips_cabs_ole_d (a, b); +} + +int test7 (double a, double b) +{ + return __builtin_mips_cabs_ule_d (a, b); +} + +int test8 (double a, double b) +{ + return __builtin_mips_cabs_sf_d (a, b); +} + +int test9 (double a, double b) +{ + return __builtin_mips_cabs_ngle_d (a, b); +} + +int test10 (double a, double b) +{ + return __builtin_mips_cabs_seq_d (a, b); +} + +int test11 (double a, double b) +{ + return __builtin_mips_cabs_ngl_d (a, b); +} + +int test12 (double a, double b) +{ + return __builtin_mips_cabs_lt_d (a, b); +} + +int test13 (double a, double b) +{ + return __builtin_mips_cabs_nge_d (a, b); +} + +int test14 (double a, double b) +{ + return __builtin_mips_cabs_le_d (a, b); +} + +int test15 (double a, double b) +{ + return __builtin_mips_cabs_ngt_d (a, b); +}
mips-3d-7.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-8.c =================================================================== --- mips-3d-8.c (nonexistent) +++ mips-3d-8.c (revision 154) @@ -0,0 +1,630 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Test MIPS-3D absolute compare and conditional move builtin functions */ +#include +#include + +typedef float v2sf __attribute__((vector_size(8))); + +v2sf test0 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test1 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test2 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test3 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test4 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test5 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test6 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test7 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test8 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test9 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test10 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test11 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test12 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test13 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test14 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test15 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test16 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test17 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test18 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test19 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test20 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test21 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test22 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test23 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test24 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test25 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test26 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test27 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test28 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test29 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test30 (v2sf a, v2sf b, v2sf c, v2sf d); +v2sf test31 (v2sf a, v2sf b, v2sf c, v2sf d); + +float qnan = 1.0f/0.0f - 1.0f/0.0f; + +int main () +{ + v2sf a, b, c, d, e, f; + + /* Case 1 {diff, diff} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {-7, -6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); + f = (v2sf) {33, 123}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); + f = (v2sf) {8, 78}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* Case 2 {same, diff} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {-5, -6}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); + f = (v2sf) {8, 123}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); + f = (v2sf) {33, 78}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* Case 3 {diff, same} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {-9, -12}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); + f = (v2sf) {33, 78}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); + f = (v2sf) {8, 123}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* Case 4 {same, same} */ + /* movt.ps */ + a = (v2sf) {5, 12}; + b = (v2sf) {-5, -12}; + c = (v2sf) {33, 123}; + d = (v2sf) {8, 78}; + e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); + f = (v2sf) {8, 78}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* movf.ps */ + e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); + f = (v2sf) {33, 123}; + if (!__builtin_mips_all_c_eq_ps (e, f)) + abort (); + + /* Test all 16 operators */ + a = (v2sf) {-123, 123}; + b = (v2sf) {1000, -1000}; + c = (v2sf) {-33, 123}; + d = (v2sf) {8, -78}; + + e = test0 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test1 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test2 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test3 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test4 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test5 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test6 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test7 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test8 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test9 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test10 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test11 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test12 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test13 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test14 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test15 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test16 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test17 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test18 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test19 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test20 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test21 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test22 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test23 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test24 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test25 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test26 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test27 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test28 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test29 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test30 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test31 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + /* Reversed arguments */ + e = test0 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test1 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test2 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test3 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test4 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test5 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test6 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test7 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test8 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test9 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test10 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test11 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test12 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test13 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test14 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test15 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test16 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test17 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test18 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test19 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test20 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test21 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test22 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test23 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test24 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test25 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test26 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test27 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test28 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test29 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test30 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test31 (b, a, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + +#ifndef __FAST_MATH__ + /* Test all 16 operators */ + a = (v2sf) {qnan, qnan}; + b = (v2sf) {1000, -1000}; + c = (v2sf) {8, -78}; + d = (v2sf) {-33, 123}; + + e = test0 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test1 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test2 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test3 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test4 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test5 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test6 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test7 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test8 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test9 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test10 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test11 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test12 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test13 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test14 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test15 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test16 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test17 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test18 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test19 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test20 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test21 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test22 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test23 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test24 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test25 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test26 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test27 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + + e = test28 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); + e = test29 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + + e = test30 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, d)) + abort (); + e = test31 (a, b, c, d); + if (!__builtin_mips_all_c_eq_ps (e, c)) + abort (); +#endif + + printf ("Test Passes\n"); + exit (0); +} + +v2sf test0 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_f_ps (a, b, c, d); +} + +v2sf test1 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_f_ps (a, b, c, d); +} + +v2sf test2 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_un_ps (a, b, c, d); +} + +v2sf test3 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_un_ps (a, b, c, d); +} + +v2sf test4 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_eq_ps (a, b, c, d); +} + +v2sf test5 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_eq_ps (a, b, c, d); +} + +v2sf test6 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ueq_ps (a, b, c, d); +} + +v2sf test7 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ueq_ps (a, b, c, d); +} + +v2sf test8 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_olt_ps (a, b, c, d); +} + +v2sf test9 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_olt_ps (a, b, c, d); +} + +v2sf test10 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ult_ps (a, b, c, d); +} + +v2sf test11 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ult_ps (a, b, c, d); +} + +v2sf test12 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ole_ps (a, b, c, d); +} + +v2sf test13 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ole_ps (a, b, c, d); +} + +v2sf test14 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ule_ps (a, b, c, d); +} + +v2sf test15 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ule_ps (a, b, c, d); +} + +v2sf test16 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_sf_ps (a, b, c, d); +} + +v2sf test17 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_sf_ps (a, b, c, d); +} + +v2sf test18 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ngle_ps (a, b, c, d); +} + +v2sf test19 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ngle_ps (a, b, c, d); +} + +v2sf test20 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_seq_ps (a, b, c, d); +} + +v2sf test21 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_seq_ps (a, b, c, d); +} + +v2sf test22 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ngl_ps (a, b, c, d); +} + +v2sf test23 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ngl_ps (a, b, c, d); +} + +v2sf test24 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_lt_ps (a, b, c, d); +} + +v2sf test25 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_lt_ps (a, b, c, d); +} + +v2sf test26 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_nge_ps (a, b, c, d); +} + +v2sf test27 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_nge_ps (a, b, c, d); +} + +v2sf test28 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_le_ps (a, b, c, d); +} + +v2sf test29 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_le_ps (a, b, c, d); +} + +v2sf test30 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movt_cabs_ngt_ps (a, b, c, d); +} + +v2sf test31 (v2sf a, v2sf b, v2sf c, v2sf d) +{ + return __builtin_mips_movf_cabs_ngt_ps (a, b, c, d); +}
mips-3d-8.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nmadd-1.c =================================================================== --- nmadd-1.c (nonexistent) +++ nmadd-1.c (revision 154) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -ffast-math -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "nmadd.s" } } */ +/* { dg-final { scan-assembler "nmadd.d" } } */ +/* { dg-final { scan-assembler "nmsub.s" } } */ +/* { dg-final { scan-assembler "nmsub.d" } } */ + +float +sub1 (float f, float g, float h) +{ + return -((f * g) + h); +} + +double +sub2 (double f, double g, double h) +{ + return -((f * g) + h); +} + +float +sub3 (float f, float g, float h) +{ + return -((f * g) - h); +} + +double +sub4 (double f, double g, double h) +{ + return -((f * g) - h); +}
nmadd-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips-3d-9.c =================================================================== --- mips-3d-9.c (nonexistent) +++ mips-3d-9.c (revision 154) @@ -0,0 +1,158 @@ +/* { dg-do run { target mipsisa64*-*-* } } */ +/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */ + +/* Matrix Multiplications */ +#include +#include + +typedef float v2sf __attribute__((vector_size(8))); + +float a[4] = {1.1, 2.2, 3.3, 4.4}; +float b[4][4] = {{1, 2, 3, 4}, + {5, 6, 7, 8}, + {9, 10, 11, 12}, + {13, 14, 15, 16}}; + +float c[4]; /* Result for matrix_multiply1() */ +float d[4]; /* Result for matrix_multiply2() */ +float e[4]; /* Result for matrix_multiply3() */ +float f[4]; /* Result for matrix_multiply4() */ + +void matrix_multiply1(); +void matrix_multiply2(); +void matrix_multiply3(); +void matrix_multiply4(); + +int main () +{ + int i; + + /* Version 1. Use float calculations */ + matrix_multiply1(); + + /* Version 2. Use paired-single instructions inside the inner loop*/ + matrix_multiply2(); + for (i = 0; i < 4; i++) + if (d[i] != c[i]) + abort(); + + /* Version 3. Use paired-single instructions and unroll the inner loop */ + matrix_multiply3(); + for (i = 0; i < 4; i++) + if (e[i] != c[i]) + abort(); + + /* Version 4. Use paired-single instructions and unroll all loops */ + matrix_multiply4(); + for (i = 0; i < 4; i++) + if (f[i] != c[i]) + abort(); + + printf ("Test Passes\n"); + exit (0); +} + +void matrix_multiply1() +{ + int i, j; + + for (i = 0; i < 4; i++) + { + c[i] = 0.0; + + for (j = 0; j < 4; j ++) + c[i] += a[j] * b[j][i]; + } +} + +void matrix_multiply2() +{ + int i, j; + v2sf m1, m2; + v2sf result, temp; + + for (i = 0; i < 4; i++) + { + result = (v2sf) {0.0, 0.0}; + + for (j = 0; j < 4; j+=2) + { + /* Load two float values into m1 */ + m1 = (v2sf) {a[j], a[j+1]}; + m2 = (v2sf) {b[j][i], b[j+1][i]}; + + /* Multiply and add */ + result += m1 * m2; + } + + /* Reduction add at the end */ + temp = __builtin_mips_addr_ps (result, result); + d[i] = __builtin_mips_cvt_s_pl (temp); + } +} + +void matrix_multiply3() +{ + int i; + v2sf m1, m2, n1, n2; + v2sf result, temp; + + m1 = (v2sf) {a[0], a[1]}; + m2 = (v2sf) {a[2], a[3]}; + + for (i = 0; i < 4; i++) + { + n1 = (v2sf) {b[0][i], b[1][i]}; + n2 = (v2sf) {b[2][i], b[3][i]}; + + /* Multiply and add */ + result = m1 * n1 + m2 * n2; + + /* Reduction add at the end */ + temp = __builtin_mips_addr_ps (result, result); + e[i] = __builtin_mips_cvt_s_pl (temp); + } +} + +void matrix_multiply4() +{ + v2sf m1, m2; + v2sf n1, n2, n3, n4, n5, n6, n7, n8; + v2sf temp1, temp2, temp3, temp4; + v2sf result1, result2; + + /* Load a[0] a[1] values into m1 + Load a[2] a[3] values into m2 */ + m1 = (v2sf) {a[0], a[1]}; + m2 = (v2sf) {a[2], a[3]}; + + /* Load b[0][0] b[1][0] values into n1 + Load b[2][0] b[3][0] values into n2 + Load b[0][1] b[1][1] values into n3 + Load b[2][1] b[3][1] values into n4 + Load b[0][2] b[1][2] values into n5 + Load b[2][2] b[3][2] values into n6 + Load b[0][3] b[1][3] values into n7 + Load b[2][3] b[3][3] values into n8 */ + n1 = (v2sf) {b[0][0], b[1][0]}; + n2 = (v2sf) {b[2][0], b[3][0]}; + n3 = (v2sf) {b[0][1], b[1][1]}; + n4 = (v2sf) {b[2][1], b[3][1]}; + n5 = (v2sf) {b[0][2], b[1][2]}; + n6 = (v2sf) {b[2][2], b[3][2]}; + n7 = (v2sf) {b[0][3], b[1][3]}; + n8 = (v2sf) {b[2][3], b[3][3]}; + + temp1 = m1 * n1 + m2 * n2; + temp2 = m1 * n3 + m2 * n4; + temp3 = m1 * n5 + m2 * n6; + temp4 = m1 * n7 + m2 * n8; + + result1 = __builtin_mips_addr_ps (temp1, temp2); + result2 = __builtin_mips_addr_ps (temp3, temp4); + + f[0] = __builtin_mips_cvt_s_pu (result1); + f[1] = __builtin_mips_cvt_s_pl (result1); + f[2] = __builtin_mips_cvt_s_pu (result2); + f[3] = __builtin_mips_cvt_s_pl (result2); +}
mips-3d-9.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nmadd-2.c =================================================================== --- nmadd-2.c (nonexistent) +++ nmadd-2.c (revision 154) @@ -0,0 +1,30 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -fno-fast-math -ffinite-math-only -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler "nmadd.s" } } */ +/* { dg-final { scan-assembler "nmadd.d" } } */ +/* { dg-final { scan-assembler "nmsub.s" } } */ +/* { dg-final { scan-assembler "nmsub.d" } } */ + +float +sub1 (float f, float g, float h) +{ + return -((f * g) + h); +} + +double +sub2 (double f, double g, double h) +{ + return -((f * g) + h); +} + +float +sub3 (float f, float g, float h) +{ + return -((f * g) - h); +} + +double +sub4 (double f, double g, double h) +{ + return -((f * g) - h); +}
nmadd-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: nmadd-3.c =================================================================== --- nmadd-3.c (nonexistent) +++ nmadd-3.c (revision 154) @@ -0,0 +1,32 @@ +/* The same code as nmadd-2.c, but compiled with -fno-finite-math-only. + We can't use nmadd and nmsub in that case. */ +/* { dg-do compile } */ +/* { dg-mips-options "-O2 -fno-fast-math -fno-finite-math-only -mips4 -mhard-float" } */ +/* { dg-final { scan-assembler-not "nmadd.s" } } */ +/* { dg-final { scan-assembler-not "nmadd.d" } } */ +/* { dg-final { scan-assembler-not "nmsub.s" } } */ +/* { dg-final { scan-assembler-not "nmsub.d" } } */ + +float +sub1 (float f, float g, float h) +{ + return -((f * g) + h); +} + +double +sub2 (double f, double g, double h) +{ + return -((f * g) + h); +} + +float +sub3 (float f, float g, float h) +{ + return -((f * g) - h); +} + +double +sub4 (double f, double g, double h) +{ + return -((f * g) - h); +}
nmadd-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr33256.c =================================================================== --- pr33256.c (nonexistent) +++ pr33256.c (revision 154) @@ -0,0 +1,11 @@ +/* GCC used to report an ICE for this test because we generated a LO_SUM + for an illegitimate constant. */ +/* { dg-mips-options "-mabi=64 -mips3 -msym32 -O2 -EB -mno-abicalls" } */ +extern unsigned long a[]; +int b (int); + +int +c (void) +{ + return b (a[0]); +}
pr33256.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: args-1.c =================================================================== --- args-1.c (nonexistent) +++ args-1.c (revision 154) @@ -0,0 +1,35 @@ +/* Check that certain preprocessor macros are defined, and do some + consistency checks. */ +/* { dg-do compile } */ + +const char *compiled_for = _MIPS_ARCH; +const char *optimized_for = _MIPS_TUNE; + +#if __mips_fpr != 32 && __mips_fpr != 64 +#error Bad __mips_fpr +#endif + +/* Test complementary macro pairs: exactly one of each pair + must be defined. */ + +#if defined (_R3000) == defined (_R4000) && !defined (__sgi__) +#error _R3000 / _R4000 mismatch +#endif + +#if defined (__mips_hard_float) == defined (__mips_soft_float) +#error __mips_hard_float / __mips_soft_float mismatch +#endif + +#if defined (_MIPSEL) == defined (_MIPSEB) +#error _MIPSEL / _MIPSEB mismatch +#endif + +/* Check for __mips64 consistency. */ + +#if defined (__mips64) != defined (_R4000) && !defined (__sgi__) +#error __mips64 / _R4000 mismatch +#endif + +#if defined (__mips64) && __mips != 3 && __mips != 4 && __mips != 64 +#error __mips64 / __mips mismatch +#endif
args-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: branch-1.c =================================================================== --- branch-1.c (nonexistent) +++ branch-1.c (revision 154) @@ -0,0 +1,11 @@ +/* We should implement these "if" statements using an "andi" instruction + followed by a branch on zero. */ +/* { dg-mips-options "-O2 -mno-mips16" } */ +void bar (void); +void f1 (int x) { if (x & 4) bar (); } +void f2 (int x) { if ((x >> 2) & 1) bar (); } +void f3 (unsigned int x) { if (x & 0x10) bar (); } +void f4 (unsigned int x) { if ((x >> 4) & 1) bar (); } +/* { dg-final { scan-assembler "\tandi\t.*\tandi\t.*\tandi\t.*\tandi\t" } } */ +/* { dg-final { scan-assembler-not "\tsrl\t" } } */ +/* { dg-final { scan-assembler-not "\tsra\t" } } */
branch-1.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: args-2.c =================================================================== --- args-2.c (nonexistent) +++ args-2.c (revision 154) @@ -0,0 +1,18 @@ +/* Check the _MIPSEB and _MIPSEL macros are accurate. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +short foo = 1; +int main () +{ + char *p = (char *) &foo; + +#ifdef _MIPSEB + if (p[0] != 0 || p[1] != 1) +#else + if (p[0] != 1 || p[1] != 0) +#endif + abort (); + exit (0); +}
args-2.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pr26765.c =================================================================== --- pr26765.c (nonexistent) +++ pr26765.c (revision 154) @@ -0,0 +1,13 @@ +/* PR target/pr26765 + This testcase used to trigger an unrecognizable insn. */ + +/* { dg-do compile } */ +/* { dg-options "-O2 -w" } */ + +__thread int *a = 0; + +void foo (void) +{ + extern int *b; + b = (int *) ((*a)); +}
pr26765.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mips16e-extends.c =================================================================== --- mips16e-extends.c (nonexistent) +++ mips16e-extends.c (revision 154) @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-mips-options "-Os -march=mips32 -mips16" } */ + +short cksum16 (unsigned long n) +{ + unsigned long l; + l = validate (n, (n >> 16) + (n & 0xffff)); + return l; +} + +char cksum8 (unsigned long n) +{ + unsigned long l; + l = validate (n, (n >> 8) + (n & 0xff)); + return l; +} + +/* { dg-final { scan-assembler "zeh" } } */ +/* { dg-final { scan-assembler "seh" } } */ +/* { dg-final { scan-assembler "zeb" } } */ +/* { dg-final { scan-assembler "seb" } } */
mips16e-extends.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: args-3.c =================================================================== --- args-3.c (nonexistent) +++ args-3.c (revision 154) @@ -0,0 +1,38 @@ +/* __mips, and related defines, guarantee that certain assembly + instructions can be used. Check a few examples. */ +/* { dg-do run } */ +extern void abort (void); +extern void exit (int); + +typedef int int32 __attribute__ ((mode (SI))); +typedef int int64 __attribute__ ((mode (DI))); +int foo (float inf, int64 in64, int32 in32) +{ + int64 res64; + int32 res32; + +#if __mips != 1 && defined (__mips_hard_float) + __asm__ ("trunc.w.s %0, %1" : "=f" (res32) : "f" (inf)); + if (res32 != 11) + abort (); +#endif + +#if defined (__mips64) + __asm__ ("daddu %0, %1, %1" : "=r" (res64) : "r" (in64)); + if (res64 != 50) + abort (); +#endif + +#if (__mips == 4 || __mips == 32 || __mips == 64) && !defined (__mips16) + __asm__ ("move %0,%.\n\tmovn %0,%1,%2" + : "=&r" (res32) : "r" (in32), "r" (in64 != 0)); + if (res32 != 60) + abort (); +#endif +} + +int main () +{ + foo (11.4f, 25, 60); + exit (0); +}
args-3.c Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.