Message ID | 20110713014359.D91F222266F@jade.mtv.corp.google.com |
---|---|
State | New |
Headers | show |
This is much better! LGTM, Gab On Tue, Jul 12, 2011 at 6:43 PM, Lawrence Crowl <crowl@google.com> wrote: > Autogenerate pph.map instead of manually maintaining it. > This change avoids tests that appear to pass only because > the pph.map file was not properly updated and the pph file was never read. > We will need to update this automation > when we start PPHing the C++ standard library. > (g++.dg/pph/pph.exp) > > Remove the existing pph.map. > > Change expectations on tests that now properly read pph files: > c1eabi1.cc x1dynarray1.cc x1dynarray2a.cc x1dynarray2b.cc x6dynarray3.cc > x6dynarray4.cc x6dynarray5.h. > > Remove incorrect -fpph-gen option from negative tests. > (lib/dg-pph.exp) > > Correct the condition on deleting the negative test assembly file. > Delete the assembly file on header tests. (These are never checked.) > (lib/dg-phh.exp) > > Support link tests, which avoids spurious messages when the link fails. > We do this by changing positive tests to track "assembly test or not" > instead of "executable test or not". > (lib/dg-phh.exp) > > Change run tests that fail to link into link tests: > x1dynarray1.cc x1dynarray2a.cc x1dynarray2b.cc > These will need to be changed back when we get them to link. > > Change header tests to recognize headers with any prefix in [cdpxy]. > (g++.dg/pph/pph.exp) > > Rename some 'c' tests to 'p' tests > because these tests use C++ namespaces by including C standard headers: > c1pr36533.* c4eabi1.* c4meteor-contest.* c4pr36533.*. > Change references to those files to match. > > > The following script will provide the status consise of the PPH tests. > > #!/bin/sh > > filter() > { > sed -e ' > /^PASS: .*test for excess errors/ d > /-fpph-map=pph.map/ ! { > /^XPASS: .*test for bogus messages/ d > /^XPASS: .*test for excess errors/ d > /^XPASS: .*execution test/ d > /^PASS: .*execution test/ d > } > /-fpph-map=pph.map/ { > /^XFAIL: .*test for excess errors/ d > } > s/ -fpph-gen *-fpph-map=pph.map / -fpph-map /g > s/ -fpph-map=pph.map / -fpph-map /g > s/, line )/)/ > s/ -I\. / /g > s/ */ /g > /^PASS: / p > /^XPASS: / p > /^XFAIL: / p > /^FAIL: / p > /^ERROR: / p > /^UNRESOLVED: / p > d > ' $* > } > > filter gcc/testsuite/g++/g++.sum | sort -u > > > Index: gcc/testsuite/ChangeLog.pph > > 2011-07-12 Lawrence Crowl <crowl@google.com> > > * lib/dg-pph.exp (dg-pph-pos): Add support for link tests. > (dg-pph-neg): Remove incorrect -fpph-gen option. > Delete unneeded assembly files. > (dg-pph-hdr): Delete unneeded assembly files. > * g++.dg/pph/pph.exp: Autogenerate pph.map instead of manual tracking. > Recognise headers with any prefix in [cdpxy]. > * g++.dg/pph/pph.map: Remove. > * g++.dg/pph/c1pr36533.h: Rename to p1pr36533.h; edit deps. > * g++.dg/pph/c1pr36533.cc: Rename to p1pr36533.cc. > * g++.dg/pph/c4eabi1.h: Rename to p4eabi1.h; edit deps. > * g++.dg/pph/c4eabi1.cc: Rename to p4eabi1.cc. > * g++.dg/pph/c4meteor-contest.h: Rename to p4meteor-contest.h; > edit deps. > * g++.dg/pph/c4meteor-contest.cc: Rename to p4meteor-contest.cc. > * g++.dg/pph/c4pr36533.h: Rename to p4pr36533.h; edit deps. > * g++.dg/pph/c4pr36533.cc: Rename to p4pr36533.cc. > * g++.dg/pph/c1eabi1.cc: Correct test expectation. > * g++.dg/pph/x1dynarray1.cc: Make link test; correct test expectation. > * g++.dg/pph/x1dynarray2a.cc: Make link test; correct test expectation. > * g++.dg/pph/x1dynarray2b.cc: Make link test; correct test expectation. > * g++.dg/pph/x6dynarray3.cc: Correct test expectation. > * g++.dg/pph/x6dynarray4.cc: Correct test expectation. > * g++.dg/pph/x6dynarray5.cc: Correct test expectation. > > > Index: gcc/testsuite/lib/dg-pph.exp > =================================================================== > --- gcc/testsuite/lib/dg-pph.exp (revision 176223) > +++ gcc/testsuite/lib/dg-pph.exp (working copy) > @@ -35,6 +35,9 @@ proc dg-pph-hdr { subdir test options ma > set dg-do-what-default preparse > dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" > > + if { [file_on_host exists "$bname.s"] } { > + file_on_host delete "$bname.s" > + } > } > > proc dg-pph-neg { subdir test options mapflag suffix } { > @@ -51,8 +54,9 @@ proc dg-pph-neg { subdir test options ma > verbose -log "\nTesting $nshort, $options" > > set dg-do-what-default compile > - dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" > - if { ![file_on_host exists "$bname.s"] } { > + dg-test -keep-output $test "$options $mapflag -I." "" > + > + if { [file_on_host exists "$bname.s"] } { > file_on_host delete "$bname.s" > } > } > @@ -74,12 +78,17 @@ proc dg-pph-pos { subdir test options ma > set dg-do-what-default compile > dg-test -keep-output $test "$options -I." "" > > - # Determine whether this is an executable test > + # Determine whether this is an assembly comparison test > set is_exec [llength [grep $test "dg-do run"]] > + set is_link [llength [grep $test "dg-do link"]] > + if { !$is_exec && !$is_link } { > + set is_asm 1 > + } else { > + set is_asm 0 > + } > > - # Executables do not generate assembly. > - if { !$is_exec } { > - # Not executable, so quit if it did not compile successfully. > + if { $is_asm } { > + # Wanted assembly, so quit if it did not compile successfully. > if { ![file_on_host exists "$bname.s"] } { > fail "$nshort $options (regular assembly missing)" > return > @@ -95,8 +104,8 @@ proc dg-pph-pos { subdir test options ma > # Compile a second time using the pph files. > dg-test -keep-output $test "$options $mapflag -I." "" > > - # Executables do not generate assembly, > - if { $is_exec } { > + if { !$is_asm } { > + # No assembly means we cannot compare them, > # and so we are done testing. > return > } > Index: gcc/testsuite/g++.dg/pph/x6dynarray3.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/x6dynarray3.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x6dynarray3.cc (working copy) > @@ -1,4 +1,5 @@ > -// { dg-do run } > +// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } > +// { dg-bogus "x6dynarray3.cc:1:0: internal compiler error: in chainon, at tree.c:2165" "" { xfail *-*-* } 0 } > > #include "x5dynarray3.h" > > Index: gcc/testsuite/g++.dg/pph/c4meteor-contest.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4meteor-contest.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4meteor-contest.cc (working copy) > @@ -1,7 +1,7 @@ > /* { dg-options "-w" } */ > // pph asm xdiff > > -#include "c4meteor-contest.h" > +#include "p4meteor-contest.h" > > int main(int argc, char **argv) { > if(argc > 1) > Index: gcc/testsuite/g++.dg/pph/c4eabi1.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4eabi1.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4eabi1.h (working copy) > @@ -1,161 +0,0 @@ > -// { dg-options "-w -fpermissive" } > -// FIXME pph - Enabling PPH for this file causes memory problems in cc1plus. > -// c1eabi1.h c1eabi1.pph > - > -#ifndef C4EABI1_H > -#define C4EABI1_H > - > -/* This file tests most of the non-C++ run-time helper functions > - described in Section 4 of the "Run-Time ABI for the ARM > - Architecture". These are basic tests; they do not try to validate > - all of the corner cases in these routines. > - > - The functions not tested here are: > - > - __aeabi_cdcmpeq > - __aeabi_cdcmple > - __aeabi_cdrcmple > - __aeabi_cfcmpeq > - __aeabi_cfcmple > - __aeabi_cfrcmple > - __aeabi_ldivmod > - __aeabi_uldivmod > - __aeabi_idivmod > - __aeabi_uidivmod > - > - These functions have non-standard calling conventions that would > - require the use of inline assembly to test. It would be good to > - add such tests, but they have not yet been implemented. > - > - There are also no tests for the "division by zero", "memory copying, > - clearing, and setting" functions. */ > - > -#include <stdio.h> > -#include <stdlib.h> > -#include <math.h> > - > -/* All these functions are defined to use the base ABI, so use the > - attribute to ensure the tests use the base ABI to call them even > - when the VFP ABI is otherwise in effect. */ > -#define PCS __attribute__((pcs("aapcs"))) > - > -#define decl_float(code, type) \ > - extern type __aeabi_ ## code ## add (type, type) PCS; \ > - extern type __aeabi_ ## code ## div (type, type) PCS; \ > - extern type __aeabi_ ## code ## mul (type, type) PCS; \ > - extern type __aeabi_ ## code ## neg (type) PCS; \ > - extern type __aeabi_ ## code ## rsub (type, type) PCS; \ > - extern type __aeabi_ ## code ## sub (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmpeq (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmplt (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmple (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmpge (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmpgt (type, type) PCS; \ > - extern int __aeabi_ ## code ## cmpun (type, type) PCS; \ > - extern int __aeabi_ ## code ## 2iz (type) PCS; \ > - extern unsigned int __aeabi_ ## code ## 2uiz (type) PCS; \ > - extern long long __aeabi_ ## code ## 2lz (type) PCS; \ > - extern unsigned long long __aeabi_ ## code ## 2ulz (type) PCS; \ > - extern type __aeabi_i2 ## code (int) PCS; \ > - extern type __aeabi_ui2 ## code (int) PCS; \ > - extern type __aeabi_l2 ## code (long long) PCS; \ > - extern type __aeabi_ul2 ## code (unsigned long long) PCS; \ > - \ > - type code ## zero = 0.0; \ > - type code ## one = 1.0; \ > - type code ## two = 2.0; \ > - type code ## four = 4.0; \ > - type code ## minus_one = -1.0; \ > - type code ## minus_two = -2.0; \ > - type code ## minus_four = -4.0; \ > - type code ## epsilon = 1E-32; \ > - type code ## NaN = 0.0 / 0.0; > - > -decl_float (d, double) > -decl_float (f, float) > - > -extern float __aeabi_d2f (double) PCS; > -extern double __aeabi_f2d (float) PCS; > -extern long long __aeabi_lmul (long long, long long); > -extern long long __aeabi_llsl (long long, int); > -extern long long __aeabi_llsr (long long, int); > -extern long long __aeabi_lasr (long long, int); > -extern int __aeabi_lcmp (long long, long long); > -extern int __aeabi_ulcmp (unsigned long long, unsigned long long); > -extern int __aeabi_idiv (int, int); > -extern unsigned int __aeabi_uidiv (unsigned int, unsigned int); > -extern int __aeabi_uread4 (void *); > -extern int __aeabi_uwrite4 (int, void *); > -extern long long __aeabi_uread8 (void *); > -extern long long __aeabi_uwrite8 (long long, void *); > - > -#define eq(a, b, type, abs, epsilon, format) \ > - { \ > - type a1; \ > - type b1; \ > - \ > - a1 = a; \ > - b1 = b; \ > - if (abs (a1 - b1) > epsilon) \ > - { \ > - fprintf (stderr, "%d: Test %s == %s\n", __LINE__, #a, #b); \ > - fprintf (stderr, "%d: " format " != " format "\n", \ > - __LINE__, a1, b1); \ > - abort (); \ > - } \ > - } > - > -#define ieq(a, b) eq (a, b, int, abs, 0, "%d") > -#define ueq(a, b) eq (a, b, unsigned int, abs, 0, "%u") > -#define leq(a, b) eq (a, b, long long, abs, 0, "%lld") > -#define uleq(a, b) eq (a, b, unsigned long long, abs, 0, "%llu") > -#define feq(a, b) eq (a, b, float, fabs, fepsilon, "%f") > -#define deq(a, b) eq (a, b, double, fabs, depsilon, "%g") > - > -#define NUM_CMP_VALUES 6 > - > -/* Values picked to cover a range of small, large, positive and negative. */ > -static unsigned int cmp_val[NUM_CMP_VALUES] = > -{ > - 0, > - 1, > - 0x40000000, > - 0x80000000, > - 0xc0000000, > - 0xffffffff > -}; > - > -/* All combinations for each of the above values. */ > -#define ulcmp(l, s, m) \ > - s, l, l, l, l, l, m, s, l, l, l, l, \ > - m, m, s, l, l, l, m, m, m, s, l, l, \ > - m, m, m, m, s, l, m, m, m, m, m, s > - > -#define lcmp(l, s, m) \ > - s, l, l, m, m, m, m, s, l, m, m, m, \ > - m, m, s, m, m, m, l, l, l, s, l, l, \ > - l, l, l, m, s, l, l, l, l, m, m, s > - > -/* All combinations of the above for high/low words. */ > -static int lcmp_results[] = > -{ > - lcmp(ulcmp(-1, -1, -1), ulcmp(-1, 0, 1), ulcmp(1, 1, 1)) > -}; > - > -static int ulcmp_results[] = > -{ > - ulcmp(ulcmp(-1, -1, -1), ulcmp(-1, 0, 1), ulcmp(1, 1, 1)) > -}; > - > -static int signof(int i) > -{ > - if (i < 0) > - return -1; > - > - if (i == 0) > - return 0; > - > - return 1; > -} > - > -#endif > Index: gcc/testsuite/g++.dg/pph/c4pr36533.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4pr36533.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4pr36533.h (working copy) > @@ -1,16 +0,0 @@ > -/* PR target/36533 */ > -/* { dg-options "-w -fpermissive" } */ > - > -#ifndef C4PR36533_H > -#define C4PR36533_H > - > -#include <sys/mman.h> > -#include <string.h> > - > -#ifndef MAP_ANONYMOUS > -#define MAP_ANONYMOUS MAP_ANON > -#endif > - > -#include "a0pr36533.h" > - > -#endif > Index: gcc/testsuite/g++.dg/pph/p4pr36533.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/p4pr36533.cc (revision 176187) > +++ gcc/testsuite/g++.dg/pph/p4pr36533.cc (working copy) > @@ -1,3 +1,2 @@ > /* { dg-options "-w -fpermissive" } */ > -// pph asm xdiff > -#include "c4pr36533.h" > +#include "p4pr36533.h" > Index: gcc/testsuite/g++.dg/pph/pph.exp > =================================================================== > --- gcc/testsuite/g++.dg/pph/pph.exp (revision 176223) > +++ gcc/testsuite/g++.dg/pph/pph.exp (working copy) > @@ -29,11 +29,17 @@ dg-init > # FIXME set scenarios [list "" "-g" "-O"] > set scenarios [list "" ] > > -set hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdx\]*.h]] > +set hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdpxy\]*.h]] > set neg_tests [lsort [glob -nocomplain $srcdir/$subdir/\[dy\]*.cc]] > set pos_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cpx\]*.cc]] > > -gcc_copy_files $srcdir/$subdir/pph.map . > +exec ls $srcdir/$subdir | sed -e /^\[cpdxy\].*\.h$/!d -e s/.*/&\t&/ -e s/\.h$/\.pph/ > pph.map > +exec echo "math.h math.pph" >> pph.map > +exec echo "stdio.h stdio.pph" >> pph.map > +exec echo "stdlib.h stdlib.pph" >> pph.map > +exec echo "string.h string.pph" >> pph.map > +exec echo "sys/types.h types.pph" >> pph.map > + > set mapflag -fpph-map=pph.map > > foreach scenario $scenarios { > Index: gcc/testsuite/g++.dg/pph/c4pr36533.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4pr36533.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4pr36533.cc (working copy) > @@ -1,2 +0,0 @@ > -/* { dg-options "-w -fpermissive" } */ > -#include "c4pr36533.h" > Index: gcc/testsuite/g++.dg/pph/pph.map > =================================================================== > --- gcc/testsuite/g++.dg/pph/pph.map (revision 176223) > +++ gcc/testsuite/g++.dg/pph/pph.map (working copy) > @@ -1,67 +0,0 @@ > -c0-20060625-1.h c0-20060625-1.pph > -c0altinc1.h c0altinc1.pph > -c3altinc2.h c3altinc2.pph > -c0attr-warn-unused.h c0attr-warn-unused.pph > -c0builtin-integral.h c0builtin-integral.pph > -c0builtin-objsize.h c0builtin-objsize.pph > -c0chained1.h c0chained1.pph > -c0chained2.h c0chained2.pph > -c1eabi1.h c1eabi1.pph > -c0empty.h c0empty.pph > -c0field.h c0field.pph > -c0funcmac.h c0funcmac.pph > -c0funcstatic.h c0funcstatic.pph > -c0functions.h c0functions.pph > -c0guarded1.h c0guarded1.pph > -c1guarded2.h c1guarded2.pph > -c1guarded3.h c1guarded3.pph > -c0limits-externalid.h c0limits-externalid.pph > -c0meteor-contest.h c0meteor-contest.pph > -c0multinc1.h c0multinc1.pph > -c1multinc2.h c1multinc2.pph > -c1pr36533.h c1pr36533.pph > -c0pr44948-1a.h c0pr44948-1a.pph > -c0return-5.h c0return-5.pph > -c0simple1.h c0simple1.pph > -c1simple2.h c1simple2.pph > -c0struct.h c0struct.pph > -c0typerefs.h c0typerefs.pph > -c0variables.h c0variables.pph > -c0varorder.h c0varorder.pph > -c0builtin1.h c0builtin1.pph > -c1builtin2.h c1builtin2.pph > -c1builtin3.h c1builtin3.pph > -c0builtin5.h c0builtin5.pph > -c0builtin6.h c0builtin6.pph > -c0dupguard1.h c0dupguard1.pph > -c0dupguard2.h c0dupguard2.pph > -c4eabi1.h c4eabi1.pph > -c4meteor-contest.h c4meteor-contest.pph > -c0paste.h c0paste.pph > -d0symnotinc.h d0symnotinc.pph > -math.h math.pph > -stdio.h stdio.pph > -stdlib.h stdlib.pph > -string.h string.pph > -sys/types.h types.pph > -x0autometh.h x0autometh.pph > -x0dynarray1.h x0dynarray1.pph > -x1funcstatic.h x1funcstatic.pph > -x1functions.h x1functions.pph > -x0globalref.h x0globalref.pph > -x0hardlookup.h x0hardlookup.pph > -x0namespace.h x0namespace.pph > -x0special.h x0special.pph > -x0struct0.h x0struct0.pph > -x1struct1.h x1struct1.pph > -x1struct2.h x1struct2.pph > -x0template.h x0template.pph > -x0ten-hellos.h x0ten-hellos.pph > -x0tmplclass.h x0tmplclass.pph > -x0tmplfunc.h x0tmplfunc.pph > -x1typerefs.h x1typerefs.pph > -x1variables.h x1variables.pph > -x0nontrivinit.h x0nontrivinit.pph > -x0overload1.h x0overload1.pph > -x0overload2.h x0overload2.pph > -x1overload3.h x1overload3.pph > Index: gcc/testsuite/g++.dg/pph/p4eabi1.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/p4eabi1.cc (revision 176187) > +++ gcc/testsuite/g++.dg/pph/p4eabi1.cc (working copy) > @@ -1,7 +1,7 @@ > // { dg-options "-w -fpermissive" } > // pph asm xdiff > > -#include "c4eabi1.h" > +#include "p4eabi1.h" > > int main () { > unsigned char bytes[256]; > Index: gcc/testsuite/g++.dg/pph/x6dynarray4.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/x6dynarray4.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x6dynarray4.cc (working copy) > @@ -1,5 +1,6 @@ > // { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } > -// { dg-bogus "cstdlib:42:0: error: PPH file stdlib.pph fails macro validation, __STDDEF_H__" "" { xfail *-*-* } 0 } > +// { dg-bogus "error: Cannot open PPH file for reading: x6dynarray5.pph: No such file or directory" "" { xfail *-*-* } 0 } > +// { dg-prune-output "In file included from" } > > #include "x6dynarray5.h" > > Index: gcc/testsuite/g++.dg/pph/x1dynarray2a.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/x1dynarray2a.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x1dynarray2a.cc (working copy) > @@ -1,4 +1,5 @@ > -// { dg-do run } > +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } > +// { dg-do link } > > #include "x0dynarray2.h" > > Index: gcc/testsuite/g++.dg/pph/c0meteor-contest.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/c0meteor-contest.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c0meteor-contest.h (working copy) > @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. > * contributed by Christian Vosteen > */ > > -/* Simplified version of c4meteor-contest.h > +/* Simplified version of p4meteor-contest.h > - Do not include other system headers here. > Simply forward declare the library functions used by this header. */ > extern "C" { > Index: gcc/testsuite/g++.dg/pph/c4meteor-contest.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4meteor-contest.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4meteor-contest.h (working copy) > @@ -1,617 +0,0 @@ > -/* { dg-options "-w" } */ > -#ifndef C4METEOR_CONTEST_H > -#define C4METEOR_CONTEST_H > -/* > -Redistribution and use in source and binary forms, with or without > -modification, are permitted provided that the following conditions are met: > - > - * Redistributions of source code must retain the above copyright > - notice, this list of conditions and the following disclaimer. > - > - * Redistributions in binary form must reproduce the above copyright > - notice, this list of conditions and the following disclaimer in the > - documentation and/or other materials provided with the distribution. > - > - * Neither the name of "The Computer Language Benchmarks Game" nor the > - name of "The Computer Language Shootout Benchmarks" nor the names of > - its contributors may be used to endorse or promote products derived > - from this software without specific prior written permission. > - > -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" > -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE > -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR > -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF > -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS > -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN > -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) > -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE > -POSSIBILITY OF SUCH DAMAGE. > -*/ > - > -/* The Computer Language Benchmarks Game > - * http://shootout.alioth.debian.org/ > - * > - * contributed by Christian Vosteen > - */ > - > -#include <stdlib.h> > -#include <stdio.h> > -#define TRUE 1 > -#define FALSE 0 > - > -/* The board is a 50 cell hexagonal pattern. For . . . . . > - * maximum speed the board will be implemented as . . . . . > - * 50 bits, which will fit into a 64 bit long long . . . . . > - * int. . . . . . > - * . . . . . > - * I will represent 0's as empty cells and 1's . . . . . > - * as full cells. . . . . . > - * . . . . . > - * . . . . . > - * . . . . . > - */ > - > -unsigned long long board = 0xFFFC000000000000ULL; > - > -/* The puzzle pieces must be specified by the path followed > - * from one end to the other along 12 hexagonal directions. > - * > - * Piece 0 Piece 1 Piece 2 Piece 3 Piece 4 > - * > - * O O O O O O O O O O O O O O O > - * O O O O O O O > - * O O O > - * > - * Piece 5 Piece 6 Piece 7 Piece 8 Piece 9 > - * > - * O O O O O O O O O O O O O > - * O O O O O O O O O > - * O O O > - * > - * I had to make it 12 directions because I wanted all of the > - * piece definitions to fit into the same size arrays. It is > - * not possible to define piece 4 in terms of the 6 cardinal > - * directions in 4 moves. > - */ > - > -#define E 0 > -#define ESE 1 > -#define SE 2 > -#define S 3 > -#define SW 4 > -#define WSW 5 > -#define W 6 > -#define WNW 7 > -#define NW 8 > -#define N 9 > -#define NE 10 > -#define ENE 11 > -#define PIVOT 12 > - > -char piece_def[10][4] = { > - { E, E, E, SE}, > - { SE, E, NE, E}, > - { E, E, SE, SW}, > - { E, E, SW, SE}, > - { SE, E, NE, S}, > - { E, E, SW, E}, > - { E, SE, SE, NE}, > - { E, SE, SE, W}, > - { E, SE, E, E}, > - { E, E, E, SW} > -}; > - > - > -/* To minimize the amount of work done in the recursive solve function below, > - * I'm going to allocate enough space for all legal rotations of each piece > - * at each position on the board. That's 10 pieces x 50 board positions x > - * 12 rotations. However, not all 12 rotations will fit on every cell, so > - * I'll have to keep count of the actual number that do. > - * The pieces are going to be unsigned long long ints just like the board so > - * they can be bitwise-anded with the board to determine if they fit. > - * I'm also going to record the next possible open cell for each piece and > - * location to reduce the burden on the solve function. > - */ > -unsigned long long pieces[10][50][12]; > -int piece_counts[10][50]; > -char next_cell[10][50][12]; > - > -/* Returns the direction rotated 60 degrees clockwise */ > -char rotate(char dir) { > - return (dir + 2) % PIVOT; > -} > - > -/* Returns the direction flipped on the horizontal axis */ > -char flip(char dir) { > - return (PIVOT - dir) % PIVOT; > -} > - > - > -/* Returns the new cell index from the specified cell in the > - * specified direction. The index is only valid if the > - * starting cell and direction have been checked by the > - * out_of_bounds function first. > - */ > -char shift(char cell, char dir) { > - switch(dir) { > - case E: > - return cell + 1; > - case ESE: > - if((cell / 5) % 2) > - return cell + 7; > - else > - return cell + 6; > - case SE: > - if((cell / 5) % 2) > - return cell + 6; > - else > - return cell + 5; > - case S: > - return cell + 10; > - case SW: > - if((cell / 5) % 2) > - return cell + 5; > - else > - return cell + 4; > - case WSW: > - if((cell / 5) % 2) > - return cell + 4; > - else > - return cell + 3; > - case W: > - return cell - 1; > - case WNW: > - if((cell / 5) % 2) > - return cell - 6; > - else > - return cell - 7; > - case NW: > - if((cell / 5) % 2) > - return cell - 5; > - else > - return cell - 6; > - case N: > - return cell - 10; > - case NE: > - if((cell / 5) % 2) > - return cell - 4; > - else > - return cell - 5; > - case ENE: > - if((cell / 5) % 2) > - return cell - 3; > - else > - return cell - 4; > - default: > - return cell; > - } > -} > - > -/* Returns wether the specified cell and direction will land outside > - * of the board. Used to determine if a piece is at a legal board > - * location or not. > - */ > -char out_of_bounds(char cell, char dir) { > - char i; > - switch(dir) { > - case E: > - return cell % 5 == 4; > - case ESE: > - i = cell % 10; > - return i == 4 || i == 8 || i == 9 || cell >= 45; > - case SE: > - return cell % 10 == 9 || cell >= 45; > - case S: > - return cell >= 40; > - case SW: > - return cell % 10 == 0 || cell >= 45; > - case WSW: > - i = cell % 10; > - return i == 0 || i == 1 || i == 5 || cell >= 45; > - case W: > - return cell % 5 == 0; > - case WNW: > - i = cell % 10; > - return i == 0 || i == 1 || i == 5 || cell < 5; > - case NW: > - return cell % 10 == 0 || cell < 5; > - case N: > - return cell < 10; > - case NE: > - return cell % 10 == 9 || cell < 5; > - case ENE: > - i = cell % 10; > - return i == 4 || i == 8 || i == 9 || cell < 5; > - default: > - return FALSE; > - } > -} > - > -/* Rotate a piece 60 degrees clockwise */ > -void rotate_piece(int piece) { > - int i; > - for(i = 0; i < 4; i++) > - piece_def[piece][i] = rotate(piece_def[piece][i]); > -} > - > -/* Flip a piece along the horizontal axis */ > -void flip_piece(int piece) { > - int i; > - for(i = 0; i < 4; i++) > - piece_def[piece][i] = flip(piece_def[piece][i]); > -} > - > -/* Convenience function to quickly calculate all of the indices for a piece */ > -void calc_cell_indices(char *cell, int piece, char index) { > - cell[0] = index; > - cell[1] = shift(cell[0], piece_def[piece][0]); > - cell[2] = shift(cell[1], piece_def[piece][1]); > - cell[3] = shift(cell[2], piece_def[piece][2]); > - cell[4] = shift(cell[3], piece_def[piece][3]); > -} > - > -/* Convenience function to quickly calculate if a piece fits on the board */ > -int cells_fit_on_board(char *cell, int piece) { > - return (!out_of_bounds(cell[0], piece_def[piece][0]) && > - !out_of_bounds(cell[1], piece_def[piece][1]) && > - !out_of_bounds(cell[2], piece_def[piece][2]) && > - !out_of_bounds(cell[3], piece_def[piece][3])); > -} > - > -/* Returns the lowest index of the cells of a piece. > - * I use the lowest index that a piece occupies as the index for looking up > - * the piece in the solve function. > - */ > -char minimum_of_cells(char *cell) { > - char minimum = cell[0]; > - minimum = cell[1] < minimum ? cell[1] : minimum; > - minimum = cell[2] < minimum ? cell[2] : minimum; > - minimum = cell[3] < minimum ? cell[3] : minimum; > - minimum = cell[4] < minimum ? cell[4] : minimum; > - return minimum; > -} > - > -/* Calculate the lowest possible open cell if the piece is placed on the board. > - * Used to later reduce the amount of time searching for open cells in the > - * solve function. > - */ > -char first_empty_cell(char *cell, char minimum) { > - char first_empty = minimum; > - while(first_empty == cell[0] || first_empty == cell[1] || > - first_empty == cell[2] || first_empty == cell[3] || > - first_empty == cell[4]) > - first_empty++; > - return first_empty; > -} > - > -/* Generate the unsigned long long int that will later be anded with the > - * board to determine if it fits. > - */ > -unsigned long long bitmask_from_cells(char *cell) { > - unsigned long long piece_mask = 0ULL; > - int i; > - for(i = 0; i < 5; i++) > - piece_mask |= 1ULL << cell[i]; > - return piece_mask; > -} > - > -/* Record the piece and other important information in arrays that will > - * later be used by the solve function. > - */ > -void record_piece(int piece, int minimum, char first_empty, > - unsigned long long piece_mask) { > - pieces[piece][minimum][piece_counts[piece][minimum]] = piece_mask; > - next_cell[piece][minimum][piece_counts[piece][minimum]] = first_empty; > - piece_counts[piece][minimum]++; > -} > - > - > -/* Fill the entire board going cell by cell. If any cells are "trapped" > - * they will be left alone. > - */ > -void fill_contiguous_space(char *board, int index) { > - if(board[index] == 1) > - return; > - board[index] = 1; > - if(!out_of_bounds(index, E)) > - fill_contiguous_space(board, shift(index, E)); > - if(!out_of_bounds(index, SE)) > - fill_contiguous_space(board, shift(index, SE)); > - if(!out_of_bounds(index, SW)) > - fill_contiguous_space(board, shift(index, SW)); > - if(!out_of_bounds(index, W)) > - fill_contiguous_space(board, shift(index, W)); > - if(!out_of_bounds(index, NW)) > - fill_contiguous_space(board, shift(index, NW)); > - if(!out_of_bounds(index, NE)) > - fill_contiguous_space(board, shift(index, NE)); > -} > - > - > -/* To thin the number of pieces, I calculate if any of them trap any empty > - * cells at the edges. There are only a handful of exceptions where the > - * the board can be solved with the trapped cells. For example: piece 8 can > - * trap 5 cells in the corner, but piece 3 can fit in those cells, or piece 0 > - * can split the board in half where both halves are viable. > - */ > -int has_island(char *cell, int piece) { > - char temp_board[50]; > - char c; > - int i; > - for(i = 0; i < 50; i++) > - temp_board[i] = 0; > - for(i = 0; i < 5; i++) > - temp_board[((int)cell[i])] = 1; > - i = 49; > - while(temp_board[i] == 1) > - i--; > - fill_contiguous_space(temp_board, i); > - c = 0; > - for(i = 0; i < 50; i++) > - if(temp_board[i] == 0) > - c++; > - if(c == 0 || (c == 5 && piece == 8) || (c == 40 && piece == 8) || > - (c % 5 == 0 && piece == 0)) > - return FALSE; > - else > - return TRUE; > -} > - > - > -/* Calculate all six rotations of the specified piece at the specified index. > - * We calculate only half of piece 3's rotations. This is because any solution > - * found has an identical solution rotated 180 degrees. Thus we can reduce the > - * number of attempted pieces in the solve algorithm by not including the 180- > - * degree-rotated pieces of ONE of the pieces. I chose piece 3 because it gave > - * me the best time ;) > - */ > - void calc_six_rotations(char piece, char index) { > - char rotation, cell[5]; > - char minimum, first_empty; > - unsigned long long piece_mask; > - > - for(rotation = 0; rotation < 6; rotation++) { > - if(piece != 3 || rotation < 3) { > - calc_cell_indices(cell, piece, index); > - if(cells_fit_on_board(cell, piece) && !has_island(cell, piece)) { > - minimum = minimum_of_cells(cell); > - first_empty = first_empty_cell(cell, minimum); > - piece_mask = bitmask_from_cells(cell); > - record_piece(piece, minimum, first_empty, piece_mask); > - } > - } > - rotate_piece(piece); > - } > -} > - > -/* Calculate every legal rotation for each piece at each board location. */ > -void calc_pieces(void) { > - char piece, index; > - > - for(piece = 0; piece < 10; piece++) { > - for(index = 0; index < 50; index++) { > - calc_six_rotations(piece, index); > - flip_piece(piece); > - calc_six_rotations(piece, index); > - } > - } > -} > - > - > - > -/* Calculate all 32 possible states for a 5-bit row and all rows that will > - * create islands that follow any of the 32 possible rows. These pre- > - * calculated 5-bit rows will be used to find islands in a partially solved > - * board in the solve function. > - */ > -#define ROW_MASK 0x1F > -#define TRIPLE_MASK 0x7FFF > -char all_rows[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, > - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; > -int bad_even_rows[32][32]; > -int bad_odd_rows[32][32]; > -int bad_even_triple[32768]; > -int bad_odd_triple[32768]; > - > -int rows_bad(char row1, char row2, int even) { > - /* even is referring to row1 */ > - int i, in_zeroes, group_okay; > - char block, row2_shift; > - /* Test for blockages at same index and shifted index */ > - if(even) > - row2_shift = ((row2 << 1) & ROW_MASK) | 0x01; > - else > - row2_shift = (row2 >> 1) | 0x10; > - block = ((row1 ^ row2) & row2) & ((row1 ^ row2_shift) & row2_shift); > - /* Test for groups of 0's */ > - in_zeroes = FALSE; > - group_okay = FALSE; > - for(i = 0; i < 5; i++) { > - if(row1 & (1 << i)) { > - if(in_zeroes) { > - if(!group_okay) > - return TRUE; > - in_zeroes = FALSE; > - group_okay = FALSE; > - } > - } else { > - if(!in_zeroes) > - in_zeroes = TRUE; > - if(!(block & (1 << i))) > - group_okay = TRUE; > - } > - } > - if(in_zeroes) > - return !group_okay; > - else > - return FALSE; > -} > - > -/* Check for cases where three rows checked sequentially cause a false > - * positive. One scenario is when 5 cells may be surrounded where piece 5 > - * or 7 can fit. The other scenario is when piece 2 creates a hook shape. > - */ > -int triple_is_okay(char row1, char row2, char row3, int even) { > - if(even) { > - /* There are four cases: > - * row1: 00011 00001 11001 10101 > - * row2: 01011 00101 10001 10001 > - * row3: 011?? 00110 ????? ????? > - */ > - return ((row1 == 0x03) && (row2 == 0x0B) && ((row3 & 0x1C) == 0x0C)) || > - ((row1 == 0x01) && (row2 == 0x05) && (row3 == 0x06)) || > - ((row1 == 0x19) && (row2 == 0x11)) || > - ((row1 == 0x15) && (row2 == 0x11)); > - } else { > - /* There are two cases: > - * row1: 10011 10101 > - * row2: 10001 10001 > - * row3: ????? ????? > - */ > - return ((row1 == 0x13) && (row2 == 0x11)) || > - ((row1 == 0x15) && (row2 == 0x11)); > - } > -} > - > - > -void calc_rows(void) { > - int row1, row2, row3; > - int result1, result2; > - for(row1 = 0; row1 < 32; row1++) { > - for(row2 = 0; row2 < 32; row2++) { > - bad_even_rows[row1][row2] = rows_bad(row1, row2, TRUE); > - bad_odd_rows[row1][row2] = rows_bad(row1, row2, FALSE); > - } > - } > - for(row1 = 0; row1 < 32; row1++) { > - for(row2 = 0; row2 < 32; row2++) { > - for(row3 = 0; row3 < 32; row3++) { > - result1 = bad_even_rows[row1][row2]; > - result2 = bad_odd_rows[row2][row3]; > - if(result1 == FALSE && result2 == TRUE > - && triple_is_okay(row1, row2, row3, TRUE)) > - bad_even_triple[row1+(row2*32)+(row3*1024)] = FALSE; > - else > - bad_even_triple[row1+(row2*32)+(row3*1024)] = result1 || result2; > - > - result1 = bad_odd_rows[row1][row2]; > - result2 = bad_even_rows[row2][row3]; > - if(result1 == FALSE && result2 == TRUE > - && triple_is_okay(row1, row2, row3, FALSE)) > - bad_odd_triple[row1+(row2*32)+(row3*1024)] = FALSE; > - else > - bad_odd_triple[row1+(row2*32)+(row3*1024)] = result1 || result2; > - } > - } > - } > -} > - > - > - > -/* Calculate islands while solving the board. > - */ > -int boardHasIslands(char cell) { > - /* Too low on board, don't bother checking */ > - if(cell >= 40) > - return FALSE; > - int current_triple = (board >> ((cell / 5) * 5)) & TRIPLE_MASK; > - if((cell / 5) % 2) > - return bad_odd_triple[current_triple]; > - else > - return bad_even_triple[current_triple]; > -} > - > - > -/* The recursive solve algorithm. Try to place each permutation in the upper- > - * leftmost empty cell. Mark off available pieces as it goes along. > - * Because the board is a bit mask, the piece number and bit mask must be saved > - * at each successful piece placement. This data is used to create a 50 char > - * array if a solution is found. > - */ > -short avail = 0x03FF; > -char sol_nums[10]; > -unsigned long long sol_masks[10]; > -signed char solutions[2100][50]; > -int solution_count = 0; > -int max_solutions = 2100; > - > -void record_solution(void) { > - int sol_no, index; > - unsigned long long sol_mask; > - for(sol_no = 0; sol_no < 10; sol_no++) { > - sol_mask = sol_masks[sol_no]; > - for(index = 0; index < 50; index++) { > - if(sol_mask & 1ULL) { > - solutions[solution_count][index] = sol_nums[sol_no]; > - /* Board rotated 180 degrees is a solution too! */ > - solutions[solution_count+1][49-index] = sol_nums[sol_no]; > - } > - sol_mask = sol_mask >> 1; > - } > - } > - solution_count += 2; > -} > - > -void solve(int depth, int cell) { > - int piece, rotation, max_rots; > - unsigned long long *piece_mask; > - short piece_no_mask; > - > - if(solution_count >= max_solutions) > - return; > - > - while(board & (1ULL << cell)) > - cell++; > - > - for(piece = 0; piece < 10; piece++) { > - piece_no_mask = 1 << piece; > - if(!(avail & piece_no_mask)) > - continue; > - avail ^= piece_no_mask; > - max_rots = piece_counts[piece][cell]; > - piece_mask = pieces[piece][cell]; > - for(rotation = 0; rotation < max_rots; rotation++) { > - if(!(board & *(piece_mask + rotation))) { > - sol_nums[depth] = piece; > - sol_masks[depth] = *(piece_mask + rotation); > - if(depth == 9) { > - /* Solution found!!!!!11!!ONE! */ > - record_solution(); > - avail ^= piece_no_mask; > - return; > - } > - board |= *(piece_mask + rotation); > - if(!boardHasIslands(next_cell[piece][cell][rotation])) > - solve(depth + 1, next_cell[piece][cell][rotation]); > - board ^= *(piece_mask + rotation); > - } > - } > - avail ^= piece_no_mask; > - } > -} > - > - > -/* qsort comparator - used to find first and last solutions */ > -int solution_sort(const void *elem1, const void *elem2) { > - signed char *char1 = (signed char *) elem1; > - signed char *char2 = (signed char *) elem2; > - int i = 0; > - while(i < 50 && char1[i] == char2[i]) > - i++; > - return char1[i] - char2[i]; > -} > - > - > -/* pretty print a board in the specified hexagonal format */ > -void pretty(signed char *b) { > - int i; > - for(i = 0; i < 50; i += 10) { > - printf("%c %c %c %c %c \n %c %c %c %c %c \n", b[i]+'0', b[i+1]+'0', > - b[i+2]+'0', b[i+3]+'0', b[i+4]+'0', b[i+5]+'0', b[i+6]+'0', > - b[i+7]+'0', b[i+8]+'0', b[i+9]+'0'); > - } > - printf("\n"); > -} > -#endif > Index: gcc/testsuite/g++.dg/pph/p2pr36533.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/p2pr36533.cc (revision 176187) > +++ gcc/testsuite/g++.dg/pph/p2pr36533.cc (working copy) > @@ -1,3 +1,2 @@ > /* { dg-options "-w -fpermissive" } */ > -// pph asm xdiff > -#include "c1pr36533.h" > +#include "p1pr36533.h" > Index: gcc/testsuite/g++.dg/pph/x6dynarray5.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/x6dynarray5.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x6dynarray5.h (working copy) > @@ -1,3 +1,6 @@ > +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } > +// { dg-bogus "a0dynarray-dfn1b.hi:3:19: error: there are no arguments to 'alloc' that depend on a template parameter, so a declaration of 'alloc' must be available" "" { xfail *-*-* } 0 } > + > #ifndef X6DYNARRAY5_H > #define X6DYNARRAY5_H > > Index: gcc/testsuite/g++.dg/pph/c1eabi1.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/c1eabi1.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c1eabi1.cc (working copy) > @@ -1,4 +1,5 @@ > // { dg-options "-w -fpermissive" } > +// pph asm xdiff > > #include "c0eabi1.h" > > Index: gcc/testsuite/g++.dg/pph/c4eabi1.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/c4eabi1.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c4eabi1.cc (working copy) > @@ -1,191 +0,0 @@ > -// { dg-options "-w -fpermissive" } > -// pph asm xdiff > - > -#include "c4eabi1.h" > - > -int main () { > - unsigned char bytes[256]; > - int i, j, k, n; > - int *result; > - > - /* Table 2. Double-precision floating-point arithmetic. */ > - deq (__aeabi_dadd (dzero, done), done); > - deq (__aeabi_dadd (done, done), dtwo); > - deq (__aeabi_ddiv (dminus_four, dminus_two), dtwo); > - deq (__aeabi_ddiv (dminus_two, dtwo), dminus_one); > - deq (__aeabi_dmul (dtwo, dtwo), dfour); > - deq (__aeabi_dmul (dminus_one, dminus_two), dtwo); > - deq (__aeabi_dneg (dminus_one), done); > - deq (__aeabi_dneg (dfour), dminus_four); > - deq (__aeabi_drsub (done, dzero), dminus_one); > - deq (__aeabi_drsub (dtwo, dminus_two), dminus_four); > - deq (__aeabi_dsub (dzero, done), dminus_one); > - deq (__aeabi_dsub (dminus_two, dtwo), dminus_four); > - > - /* Table 3. Double-precision floating-point comparisons. */ > - ieq (__aeabi_dcmpeq (done, done), 1); > - ieq (__aeabi_dcmpeq (done, dzero), 0); > - ieq (__aeabi_dcmpeq (dNaN, dzero), 0); > - ieq (__aeabi_dcmpeq (dNaN, dNaN), 0); > - > - ieq (__aeabi_dcmplt (dzero, done), 1); > - ieq (__aeabi_dcmplt (done, dzero), 0); > - ieq (__aeabi_dcmplt (dzero, dzero), 0); > - ieq (__aeabi_dcmplt (dzero, dNaN), 0); > - ieq (__aeabi_dcmplt (dNaN, dNaN), 0); > - > - ieq (__aeabi_dcmple (dzero, done), 1); > - ieq (__aeabi_dcmple (done, dzero), 0); > - ieq (__aeabi_dcmple (dzero, dzero), 1); > - ieq (__aeabi_dcmple (dzero, dNaN), 0); > - ieq (__aeabi_dcmple (dNaN, dNaN), 0); > - > - ieq (__aeabi_dcmpge (dzero, done), 0); > - ieq (__aeabi_dcmpge (done, dzero), 1); > - ieq (__aeabi_dcmpge (dzero, dzero), 1); > - ieq (__aeabi_dcmpge (dzero, dNaN), 0); > - ieq (__aeabi_dcmpge (dNaN, dNaN), 0); > - > - ieq (__aeabi_dcmpgt (dzero, done), 0); > - ieq (__aeabi_dcmpgt (done, dzero), 1); > - ieq (__aeabi_dcmplt (dzero, dzero), 0); > - ieq (__aeabi_dcmpgt (dzero, dNaN), 0); > - ieq (__aeabi_dcmpgt (dNaN, dNaN), 0); > - > - ieq (__aeabi_dcmpun (done, done), 0); > - ieq (__aeabi_dcmpun (done, dzero), 0); > - ieq (__aeabi_dcmpun (dNaN, dzero), 1); > - ieq (__aeabi_dcmpun (dNaN, dNaN), 1); > - > - /* Table 4. Single-precision floating-point arithmetic. */ > - feq (__aeabi_fadd (fzero, fone), fone); > - feq (__aeabi_fadd (fone, fone), ftwo); > - feq (__aeabi_fdiv (fminus_four, fminus_two), ftwo); > - feq (__aeabi_fdiv (fminus_two, ftwo), fminus_one); > - feq (__aeabi_fmul (ftwo, ftwo), ffour); > - feq (__aeabi_fmul (fminus_one, fminus_two), ftwo); > - feq (__aeabi_fneg (fminus_one), fone); > - feq (__aeabi_fneg (ffour), fminus_four); > - feq (__aeabi_frsub (fone, fzero), fminus_one); > - feq (__aeabi_frsub (ftwo, fminus_two), fminus_four); > - feq (__aeabi_fsub (fzero, fone), fminus_one); > - feq (__aeabi_fsub (fminus_two, ftwo), fminus_four); > - > - /* Table 5. Single-precision floating-point comparisons. */ > - ieq (__aeabi_fcmpeq (fone, fone), 1); > - ieq (__aeabi_fcmpeq (fone, fzero), 0); > - ieq (__aeabi_fcmpeq (fNaN, fzero), 0); > - ieq (__aeabi_fcmpeq (fNaN, fNaN), 0); > - > - ieq (__aeabi_fcmplt (fzero, fone), 1); > - ieq (__aeabi_fcmplt (fone, fzero), 0); > - ieq (__aeabi_fcmplt (fzero, fzero), 0); > - ieq (__aeabi_fcmplt (fzero, fNaN), 0); > - ieq (__aeabi_fcmplt (fNaN, fNaN), 0); > - > - ieq (__aeabi_fcmple (fzero, fone), 1); > - ieq (__aeabi_fcmple (fone, fzero), 0); > - ieq (__aeabi_fcmple (fzero, fzero), 1); > - ieq (__aeabi_fcmple (fzero, fNaN), 0); > - ieq (__aeabi_fcmple (fNaN, fNaN), 0); > - > - ieq (__aeabi_fcmpge (fzero, fone), 0); > - ieq (__aeabi_fcmpge (fone, fzero), 1); > - ieq (__aeabi_fcmpge (fzero, fzero), 1); > - ieq (__aeabi_fcmpge (fzero, fNaN), 0); > - ieq (__aeabi_fcmpge (fNaN, fNaN), 0); > - > - ieq (__aeabi_fcmpgt (fzero, fone), 0); > - ieq (__aeabi_fcmpgt (fone, fzero), 1); > - ieq (__aeabi_fcmplt (fzero, fzero), 0); > - ieq (__aeabi_fcmpgt (fzero, fNaN), 0); > - ieq (__aeabi_fcmpgt (fNaN, fNaN), 0); > - > - ieq (__aeabi_fcmpun (fone, fone), 0); > - ieq (__aeabi_fcmpun (fone, fzero), 0); > - ieq (__aeabi_fcmpun (fNaN, fzero), 1); > - ieq (__aeabi_fcmpun (fNaN, fNaN), 1); > - > - /* Table 6. Floating-point to integer conversions. */ > - ieq (__aeabi_d2iz (dminus_one), -1); > - ueq (__aeabi_d2uiz (done), 1); > - leq (__aeabi_d2lz (dminus_two), -2LL); > - uleq (__aeabi_d2ulz (dfour), 4LL); > - ieq (__aeabi_f2iz (fminus_one), -1); > - ueq (__aeabi_f2uiz (fone), 1); > - leq (__aeabi_f2lz (fminus_two), -2LL); > - uleq (__aeabi_f2ulz (ffour), 4LL); > - > - /* Table 7. Conversions between floating types. */ > - feq (__aeabi_d2f (dtwo), ftwo); > - deq (__aeabi_f2d (fminus_four), dminus_four); > - > - /* Table 8. Integer to floating-point conversions. */ > - deq (__aeabi_i2d (-1), dminus_one); > - deq (__aeabi_ui2d (2), dtwo); > - deq (__aeabi_l2d (-1), dminus_one); > - deq (__aeabi_ul2d (2ULL), dtwo); > - feq (__aeabi_i2f (-1), fminus_one); > - feq (__aeabi_ui2f (2), ftwo); > - feq (__aeabi_l2f (-1), fminus_one); > - feq (__aeabi_ul2f (2ULL), ftwo); > - > - /* Table 9. Long long functions. */ > - leq (__aeabi_lmul (4LL, -1LL), -4LL); > - leq (__aeabi_llsl (2LL, 1), 4LL); > - leq (__aeabi_llsr (-1LL, 63), 1); > - leq (__aeabi_lasr (-1LL, 63), -1); > - > - result = lcmp_results; > - for (i = 0; i < NUM_CMP_VALUES; i++) > - for (j = 0; j < NUM_CMP_VALUES; j++) > - for (k = 0; k < NUM_CMP_VALUES; k++) > - for (n = 0; n < NUM_CMP_VALUES; n++) > - { > - ieq (signof (__aeabi_lcmp > - (((long long)cmp_val[i] << 32) | cmp_val[k], > - ((long long)cmp_val[j] << 32) | cmp_val[n])), > - *result); > - result++; > - } > - result = ulcmp_results; > - for (i = 0; i < NUM_CMP_VALUES; i++) > - for (j = 0; j < NUM_CMP_VALUES; j++) > - for (k = 0; k < NUM_CMP_VALUES; k++) > - for (n = 0; n < NUM_CMP_VALUES; n++) > - { > - ieq (signof (__aeabi_ulcmp > - (((long long)cmp_val[i] << 32) | cmp_val[k], > - ((long long)cmp_val[j] << 32) | cmp_val[n])), > - *result); > - result++; > - } > - > - ieq (__aeabi_idiv (-550, 11), -50); > - ueq (__aeabi_uidiv (4000000000U, 1000000U), 4000U); > - > - for (i = 0; i < 256; i++) > - bytes[i] = i; > - > -#ifdef __ARMEB__ > - ieq (__aeabi_uread4 (bytes + 1), 0x01020304U); > - leq (__aeabi_uread8 (bytes + 3), 0x030405060708090aLL); > - ieq (__aeabi_uwrite4 (0x66778899U, bytes + 5), 0x66778899U); > - leq (__aeabi_uwrite8 (0x2030405060708090LL, bytes + 15), > - 0x2030405060708090LL); > -#else > - ieq (__aeabi_uread4 (bytes + 1), 0x04030201U); > - leq (__aeabi_uread8 (bytes + 3), 0x0a09080706050403LL); > - ieq (__aeabi_uwrite4 (0x99887766U, bytes + 5), 0x99887766U); > - leq (__aeabi_uwrite8 (0x9080706050403020LL, bytes + 15), > - 0x9080706050403020LL); > -#endif > - > - for (i = 0; i < 4; i++) > - ieq (bytes[5 + i], (6 + i) * 0x11); > - > - for (i = 0; i < 8; i++) > - ieq (bytes[15 + i], (2 + i) * 0x10); > - > - exit (0); > -} > Index: gcc/testsuite/g++.dg/pph/c2pr36533.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/c2pr36533.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c2pr36533.cc (working copy) > @@ -1,2 +0,0 @@ > -/* { dg-options "-w -fpermissive" } */ > -#include "c1pr36533.h" > Index: gcc/testsuite/g++.dg/pph/c1pr36533.h > =================================================================== > --- gcc/testsuite/g++.dg/pph/c1pr36533.h (revision 176223) > +++ gcc/testsuite/g++.dg/pph/c1pr36533.h (working copy) > @@ -1,16 +0,0 @@ > -/* PR target/36533 */ > -/* { dg-options "-w -fpermissive" } */ > - > -#ifndef C1PR36533_H > -#define C1PR36533_H > - > -#include <string.h> > -#include <sys/mman.h> > - > -#ifndef MAP_ANONYMOUS > -#define MAP_ANONYMOUS MAP_ANON > -#endif > - > -#include "a0pr36533.h" > - > -#endif > Index: gcc/testsuite/g++.dg/pph/x1dynarray1.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/x1dynarray1.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x1dynarray1.cc (working copy) > @@ -1,4 +1,4 @@ > -// { dg-do run } > +// { dg-do link } > // { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } > > #include "x0dynarray1.h" > Index: gcc/testsuite/g++.dg/pph/x1dynarray2b.cc > =================================================================== > --- gcc/testsuite/g++.dg/pph/x1dynarray2b.cc (revision 176223) > +++ gcc/testsuite/g++.dg/pph/x1dynarray2b.cc (working copy) > @@ -1,4 +1,5 @@ > -// { dg-do run } > +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } > +// { dg-do link } > > #include "x0dynarray2.h" > > > -- > This patch is available for review at http://codereview.appspot.com/4699047 >
Index: gcc/testsuite/ChangeLog.pph 2011-07-12 Lawrence Crowl <crowl@google.com> * lib/dg-pph.exp (dg-pph-pos): Add support for link tests. (dg-pph-neg): Remove incorrect -fpph-gen option. Delete unneeded assembly files. (dg-pph-hdr): Delete unneeded assembly files. * g++.dg/pph/pph.exp: Autogenerate pph.map instead of manual tracking. Recognise headers with any prefix in [cdpxy]. * g++.dg/pph/pph.map: Remove. * g++.dg/pph/c1pr36533.h: Rename to p1pr36533.h; edit deps. * g++.dg/pph/c1pr36533.cc: Rename to p1pr36533.cc. * g++.dg/pph/c4eabi1.h: Rename to p4eabi1.h; edit deps. * g++.dg/pph/c4eabi1.cc: Rename to p4eabi1.cc. * g++.dg/pph/c4meteor-contest.h: Rename to p4meteor-contest.h; edit deps. * g++.dg/pph/c4meteor-contest.cc: Rename to p4meteor-contest.cc. * g++.dg/pph/c4pr36533.h: Rename to p4pr36533.h; edit deps. * g++.dg/pph/c4pr36533.cc: Rename to p4pr36533.cc. * g++.dg/pph/c1eabi1.cc: Correct test expectation. * g++.dg/pph/x1dynarray1.cc: Make link test; correct test expectation. * g++.dg/pph/x1dynarray2a.cc: Make link test; correct test expectation. * g++.dg/pph/x1dynarray2b.cc: Make link test; correct test expectation. * g++.dg/pph/x6dynarray3.cc: Correct test expectation. * g++.dg/pph/x6dynarray4.cc: Correct test expectation. * g++.dg/pph/x6dynarray5.cc: Correct test expectation. Index: gcc/testsuite/lib/dg-pph.exp =================================================================== --- gcc/testsuite/lib/dg-pph.exp (revision 176223) +++ gcc/testsuite/lib/dg-pph.exp (working copy) @@ -35,6 +35,9 @@ proc dg-pph-hdr { subdir test options ma set dg-do-what-default preparse dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" + if { [file_on_host exists "$bname.s"] } { + file_on_host delete "$bname.s" + } } proc dg-pph-neg { subdir test options mapflag suffix } { @@ -51,8 +54,9 @@ proc dg-pph-neg { subdir test options ma verbose -log "\nTesting $nshort, $options" set dg-do-what-default compile - dg-test -keep-output $test "-fpph-gen $options $mapflag -I." "" - if { ![file_on_host exists "$bname.s"] } { + dg-test -keep-output $test "$options $mapflag -I." "" + + if { [file_on_host exists "$bname.s"] } { file_on_host delete "$bname.s" } } @@ -74,12 +78,17 @@ proc dg-pph-pos { subdir test options ma set dg-do-what-default compile dg-test -keep-output $test "$options -I." "" - # Determine whether this is an executable test + # Determine whether this is an assembly comparison test set is_exec [llength [grep $test "dg-do run"]] + set is_link [llength [grep $test "dg-do link"]] + if { !$is_exec && !$is_link } { + set is_asm 1 + } else { + set is_asm 0 + } - # Executables do not generate assembly. - if { !$is_exec } { - # Not executable, so quit if it did not compile successfully. + if { $is_asm } { + # Wanted assembly, so quit if it did not compile successfully. if { ![file_on_host exists "$bname.s"] } { fail "$nshort $options (regular assembly missing)" return @@ -95,8 +104,8 @@ proc dg-pph-pos { subdir test options ma # Compile a second time using the pph files. dg-test -keep-output $test "$options $mapflag -I." "" - # Executables do not generate assembly, - if { $is_exec } { + if { !$is_asm } { + # No assembly means we cannot compare them, # and so we are done testing. return } Index: gcc/testsuite/g++.dg/pph/x6dynarray3.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x6dynarray3.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/x6dynarray3.cc (working copy) @@ -1,4 +1,5 @@ -// { dg-do run } +// { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-bogus "x6dynarray3.cc:1:0: internal compiler error: in chainon, at tree.c:2165" "" { xfail *-*-* } 0 } #include "x5dynarray3.h" Index: gcc/testsuite/g++.dg/pph/c4meteor-contest.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c4meteor-contest.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4meteor-contest.cc (working copy) @@ -1,7 +1,7 @@ /* { dg-options "-w" } */ // pph asm xdiff -#include "c4meteor-contest.h" +#include "p4meteor-contest.h" int main(int argc, char **argv) { if(argc > 1) Index: gcc/testsuite/g++.dg/pph/c4eabi1.h =================================================================== --- gcc/testsuite/g++.dg/pph/c4eabi1.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4eabi1.h (working copy) @@ -1,161 +0,0 @@ -// { dg-options "-w -fpermissive" } -// FIXME pph - Enabling PPH for this file causes memory problems in cc1plus. -// c1eabi1.h c1eabi1.pph - -#ifndef C4EABI1_H -#define C4EABI1_H - -/* This file tests most of the non-C++ run-time helper functions - described in Section 4 of the "Run-Time ABI for the ARM - Architecture". These are basic tests; they do not try to validate - all of the corner cases in these routines. - - The functions not tested here are: - - __aeabi_cdcmpeq - __aeabi_cdcmple - __aeabi_cdrcmple - __aeabi_cfcmpeq - __aeabi_cfcmple - __aeabi_cfrcmple - __aeabi_ldivmod - __aeabi_uldivmod - __aeabi_idivmod - __aeabi_uidivmod - - These functions have non-standard calling conventions that would - require the use of inline assembly to test. It would be good to - add such tests, but they have not yet been implemented. - - There are also no tests for the "division by zero", "memory copying, - clearing, and setting" functions. */ - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - -/* All these functions are defined to use the base ABI, so use the - attribute to ensure the tests use the base ABI to call them even - when the VFP ABI is otherwise in effect. */ -#define PCS __attribute__((pcs("aapcs"))) - -#define decl_float(code, type) \ - extern type __aeabi_ ## code ## add (type, type) PCS; \ - extern type __aeabi_ ## code ## div (type, type) PCS; \ - extern type __aeabi_ ## code ## mul (type, type) PCS; \ - extern type __aeabi_ ## code ## neg (type) PCS; \ - extern type __aeabi_ ## code ## rsub (type, type) PCS; \ - extern type __aeabi_ ## code ## sub (type, type) PCS; \ - extern int __aeabi_ ## code ## cmpeq (type, type) PCS; \ - extern int __aeabi_ ## code ## cmplt (type, type) PCS; \ - extern int __aeabi_ ## code ## cmple (type, type) PCS; \ - extern int __aeabi_ ## code ## cmpge (type, type) PCS; \ - extern int __aeabi_ ## code ## cmpgt (type, type) PCS; \ - extern int __aeabi_ ## code ## cmpun (type, type) PCS; \ - extern int __aeabi_ ## code ## 2iz (type) PCS; \ - extern unsigned int __aeabi_ ## code ## 2uiz (type) PCS; \ - extern long long __aeabi_ ## code ## 2lz (type) PCS; \ - extern unsigned long long __aeabi_ ## code ## 2ulz (type) PCS; \ - extern type __aeabi_i2 ## code (int) PCS; \ - extern type __aeabi_ui2 ## code (int) PCS; \ - extern type __aeabi_l2 ## code (long long) PCS; \ - extern type __aeabi_ul2 ## code (unsigned long long) PCS; \ - \ - type code ## zero = 0.0; \ - type code ## one = 1.0; \ - type code ## two = 2.0; \ - type code ## four = 4.0; \ - type code ## minus_one = -1.0; \ - type code ## minus_two = -2.0; \ - type code ## minus_four = -4.0; \ - type code ## epsilon = 1E-32; \ - type code ## NaN = 0.0 / 0.0; - -decl_float (d, double) -decl_float (f, float) - -extern float __aeabi_d2f (double) PCS; -extern double __aeabi_f2d (float) PCS; -extern long long __aeabi_lmul (long long, long long); -extern long long __aeabi_llsl (long long, int); -extern long long __aeabi_llsr (long long, int); -extern long long __aeabi_lasr (long long, int); -extern int __aeabi_lcmp (long long, long long); -extern int __aeabi_ulcmp (unsigned long long, unsigned long long); -extern int __aeabi_idiv (int, int); -extern unsigned int __aeabi_uidiv (unsigned int, unsigned int); -extern int __aeabi_uread4 (void *); -extern int __aeabi_uwrite4 (int, void *); -extern long long __aeabi_uread8 (void *); -extern long long __aeabi_uwrite8 (long long, void *); - -#define eq(a, b, type, abs, epsilon, format) \ - { \ - type a1; \ - type b1; \ - \ - a1 = a; \ - b1 = b; \ - if (abs (a1 - b1) > epsilon) \ - { \ - fprintf (stderr, "%d: Test %s == %s\n", __LINE__, #a, #b); \ - fprintf (stderr, "%d: " format " != " format "\n", \ - __LINE__, a1, b1); \ - abort (); \ - } \ - } - -#define ieq(a, b) eq (a, b, int, abs, 0, "%d") -#define ueq(a, b) eq (a, b, unsigned int, abs, 0, "%u") -#define leq(a, b) eq (a, b, long long, abs, 0, "%lld") -#define uleq(a, b) eq (a, b, unsigned long long, abs, 0, "%llu") -#define feq(a, b) eq (a, b, float, fabs, fepsilon, "%f") -#define deq(a, b) eq (a, b, double, fabs, depsilon, "%g") - -#define NUM_CMP_VALUES 6 - -/* Values picked to cover a range of small, large, positive and negative. */ -static unsigned int cmp_val[NUM_CMP_VALUES] = -{ - 0, - 1, - 0x40000000, - 0x80000000, - 0xc0000000, - 0xffffffff -}; - -/* All combinations for each of the above values. */ -#define ulcmp(l, s, m) \ - s, l, l, l, l, l, m, s, l, l, l, l, \ - m, m, s, l, l, l, m, m, m, s, l, l, \ - m, m, m, m, s, l, m, m, m, m, m, s - -#define lcmp(l, s, m) \ - s, l, l, m, m, m, m, s, l, m, m, m, \ - m, m, s, m, m, m, l, l, l, s, l, l, \ - l, l, l, m, s, l, l, l, l, m, m, s - -/* All combinations of the above for high/low words. */ -static int lcmp_results[] = -{ - lcmp(ulcmp(-1, -1, -1), ulcmp(-1, 0, 1), ulcmp(1, 1, 1)) -}; - -static int ulcmp_results[] = -{ - ulcmp(ulcmp(-1, -1, -1), ulcmp(-1, 0, 1), ulcmp(1, 1, 1)) -}; - -static int signof(int i) -{ - if (i < 0) - return -1; - - if (i == 0) - return 0; - - return 1; -} - -#endif Index: gcc/testsuite/g++.dg/pph/c4pr36533.h =================================================================== --- gcc/testsuite/g++.dg/pph/c4pr36533.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4pr36533.h (working copy) @@ -1,16 +0,0 @@ -/* PR target/36533 */ -/* { dg-options "-w -fpermissive" } */ - -#ifndef C4PR36533_H -#define C4PR36533_H - -#include <sys/mman.h> -#include <string.h> - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -#include "a0pr36533.h" - -#endif Index: gcc/testsuite/g++.dg/pph/p4pr36533.cc =================================================================== --- gcc/testsuite/g++.dg/pph/p4pr36533.cc (revision 176187) +++ gcc/testsuite/g++.dg/pph/p4pr36533.cc (working copy) @@ -1,3 +1,2 @@ /* { dg-options "-w -fpermissive" } */ -// pph asm xdiff -#include "c4pr36533.h" +#include "p4pr36533.h" Index: gcc/testsuite/g++.dg/pph/pph.exp =================================================================== --- gcc/testsuite/g++.dg/pph/pph.exp (revision 176223) +++ gcc/testsuite/g++.dg/pph/pph.exp (working copy) @@ -29,11 +29,17 @@ dg-init # FIXME set scenarios [list "" "-g" "-O"] set scenarios [list "" ] -set hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdx\]*.h]] +set hdr_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cdpxy\]*.h]] set neg_tests [lsort [glob -nocomplain $srcdir/$subdir/\[dy\]*.cc]] set pos_tests [lsort [glob -nocomplain $srcdir/$subdir/\[cpx\]*.cc]] -gcc_copy_files $srcdir/$subdir/pph.map . +exec ls $srcdir/$subdir | sed -e /^\[cpdxy\].*\.h$/!d -e s/.*/&\t&/ -e s/\.h$/\.pph/ > pph.map +exec echo "math.h math.pph" >> pph.map +exec echo "stdio.h stdio.pph" >> pph.map +exec echo "stdlib.h stdlib.pph" >> pph.map +exec echo "string.h string.pph" >> pph.map +exec echo "sys/types.h types.pph" >> pph.map + set mapflag -fpph-map=pph.map foreach scenario $scenarios { Index: gcc/testsuite/g++.dg/pph/c4pr36533.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c4pr36533.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4pr36533.cc (working copy) @@ -1,2 +0,0 @@ -/* { dg-options "-w -fpermissive" } */ -#include "c4pr36533.h" Index: gcc/testsuite/g++.dg/pph/pph.map =================================================================== --- gcc/testsuite/g++.dg/pph/pph.map (revision 176223) +++ gcc/testsuite/g++.dg/pph/pph.map (working copy) @@ -1,67 +0,0 @@ -c0-20060625-1.h c0-20060625-1.pph -c0altinc1.h c0altinc1.pph -c3altinc2.h c3altinc2.pph -c0attr-warn-unused.h c0attr-warn-unused.pph -c0builtin-integral.h c0builtin-integral.pph -c0builtin-objsize.h c0builtin-objsize.pph -c0chained1.h c0chained1.pph -c0chained2.h c0chained2.pph -c1eabi1.h c1eabi1.pph -c0empty.h c0empty.pph -c0field.h c0field.pph -c0funcmac.h c0funcmac.pph -c0funcstatic.h c0funcstatic.pph -c0functions.h c0functions.pph -c0guarded1.h c0guarded1.pph -c1guarded2.h c1guarded2.pph -c1guarded3.h c1guarded3.pph -c0limits-externalid.h c0limits-externalid.pph -c0meteor-contest.h c0meteor-contest.pph -c0multinc1.h c0multinc1.pph -c1multinc2.h c1multinc2.pph -c1pr36533.h c1pr36533.pph -c0pr44948-1a.h c0pr44948-1a.pph -c0return-5.h c0return-5.pph -c0simple1.h c0simple1.pph -c1simple2.h c1simple2.pph -c0struct.h c0struct.pph -c0typerefs.h c0typerefs.pph -c0variables.h c0variables.pph -c0varorder.h c0varorder.pph -c0builtin1.h c0builtin1.pph -c1builtin2.h c1builtin2.pph -c1builtin3.h c1builtin3.pph -c0builtin5.h c0builtin5.pph -c0builtin6.h c0builtin6.pph -c0dupguard1.h c0dupguard1.pph -c0dupguard2.h c0dupguard2.pph -c4eabi1.h c4eabi1.pph -c4meteor-contest.h c4meteor-contest.pph -c0paste.h c0paste.pph -d0symnotinc.h d0symnotinc.pph -math.h math.pph -stdio.h stdio.pph -stdlib.h stdlib.pph -string.h string.pph -sys/types.h types.pph -x0autometh.h x0autometh.pph -x0dynarray1.h x0dynarray1.pph -x1funcstatic.h x1funcstatic.pph -x1functions.h x1functions.pph -x0globalref.h x0globalref.pph -x0hardlookup.h x0hardlookup.pph -x0namespace.h x0namespace.pph -x0special.h x0special.pph -x0struct0.h x0struct0.pph -x1struct1.h x1struct1.pph -x1struct2.h x1struct2.pph -x0template.h x0template.pph -x0ten-hellos.h x0ten-hellos.pph -x0tmplclass.h x0tmplclass.pph -x0tmplfunc.h x0tmplfunc.pph -x1typerefs.h x1typerefs.pph -x1variables.h x1variables.pph -x0nontrivinit.h x0nontrivinit.pph -x0overload1.h x0overload1.pph -x0overload2.h x0overload2.pph -x1overload3.h x1overload3.pph Index: gcc/testsuite/g++.dg/pph/p4eabi1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/p4eabi1.cc (revision 176187) +++ gcc/testsuite/g++.dg/pph/p4eabi1.cc (working copy) @@ -1,7 +1,7 @@ // { dg-options "-w -fpermissive" } // pph asm xdiff -#include "c4eabi1.h" +#include "p4eabi1.h" int main () { unsigned char bytes[256]; Index: gcc/testsuite/g++.dg/pph/x6dynarray4.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x6dynarray4.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/x6dynarray4.cc (working copy) @@ -1,5 +1,6 @@ // { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } -// { dg-bogus "cstdlib:42:0: error: PPH file stdlib.pph fails macro validation, __STDDEF_H__" "" { xfail *-*-* } 0 } +// { dg-bogus "error: Cannot open PPH file for reading: x6dynarray5.pph: No such file or directory" "" { xfail *-*-* } 0 } +// { dg-prune-output "In file included from" } #include "x6dynarray5.h" Index: gcc/testsuite/g++.dg/pph/x1dynarray2a.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1dynarray2a.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/x1dynarray2a.cc (working copy) @@ -1,4 +1,5 @@ -// { dg-do run } +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-do link } #include "x0dynarray2.h" Index: gcc/testsuite/g++.dg/pph/c0meteor-contest.h =================================================================== --- gcc/testsuite/g++.dg/pph/c0meteor-contest.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/c0meteor-contest.h (working copy) @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. * contributed by Christian Vosteen */ -/* Simplified version of c4meteor-contest.h +/* Simplified version of p4meteor-contest.h - Do not include other system headers here. Simply forward declare the library functions used by this header. */ extern "C" { Index: gcc/testsuite/g++.dg/pph/c4meteor-contest.h =================================================================== --- gcc/testsuite/g++.dg/pph/c4meteor-contest.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4meteor-contest.h (working copy) @@ -1,617 +0,0 @@ -/* { dg-options "-w" } */ -#ifndef C4METEOR_CONTEST_H -#define C4METEOR_CONTEST_H -/* -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of "The Computer Language Benchmarks Game" nor the - name of "The Computer Language Shootout Benchmarks" nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -/* The Computer Language Benchmarks Game - * http://shootout.alioth.debian.org/ - * - * contributed by Christian Vosteen - */ - -#include <stdlib.h> -#include <stdio.h> -#define TRUE 1 -#define FALSE 0 - -/* The board is a 50 cell hexagonal pattern. For . . . . . - * maximum speed the board will be implemented as . . . . . - * 50 bits, which will fit into a 64 bit long long . . . . . - * int. . . . . . - * . . . . . - * I will represent 0's as empty cells and 1's . . . . . - * as full cells. . . . . . - * . . . . . - * . . . . . - * . . . . . - */ - -unsigned long long board = 0xFFFC000000000000ULL; - -/* The puzzle pieces must be specified by the path followed - * from one end to the other along 12 hexagonal directions. - * - * Piece 0 Piece 1 Piece 2 Piece 3 Piece 4 - * - * O O O O O O O O O O O O O O O - * O O O O O O O - * O O O - * - * Piece 5 Piece 6 Piece 7 Piece 8 Piece 9 - * - * O O O O O O O O O O O O O - * O O O O O O O O O - * O O O - * - * I had to make it 12 directions because I wanted all of the - * piece definitions to fit into the same size arrays. It is - * not possible to define piece 4 in terms of the 6 cardinal - * directions in 4 moves. - */ - -#define E 0 -#define ESE 1 -#define SE 2 -#define S 3 -#define SW 4 -#define WSW 5 -#define W 6 -#define WNW 7 -#define NW 8 -#define N 9 -#define NE 10 -#define ENE 11 -#define PIVOT 12 - -char piece_def[10][4] = { - { E, E, E, SE}, - { SE, E, NE, E}, - { E, E, SE, SW}, - { E, E, SW, SE}, - { SE, E, NE, S}, - { E, E, SW, E}, - { E, SE, SE, NE}, - { E, SE, SE, W}, - { E, SE, E, E}, - { E, E, E, SW} -}; - - -/* To minimize the amount of work done in the recursive solve function below, - * I'm going to allocate enough space for all legal rotations of each piece - * at each position on the board. That's 10 pieces x 50 board positions x - * 12 rotations. However, not all 12 rotations will fit on every cell, so - * I'll have to keep count of the actual number that do. - * The pieces are going to be unsigned long long ints just like the board so - * they can be bitwise-anded with the board to determine if they fit. - * I'm also going to record the next possible open cell for each piece and - * location to reduce the burden on the solve function. - */ -unsigned long long pieces[10][50][12]; -int piece_counts[10][50]; -char next_cell[10][50][12]; - -/* Returns the direction rotated 60 degrees clockwise */ -char rotate(char dir) { - return (dir + 2) % PIVOT; -} - -/* Returns the direction flipped on the horizontal axis */ -char flip(char dir) { - return (PIVOT - dir) % PIVOT; -} - - -/* Returns the new cell index from the specified cell in the - * specified direction. The index is only valid if the - * starting cell and direction have been checked by the - * out_of_bounds function first. - */ -char shift(char cell, char dir) { - switch(dir) { - case E: - return cell + 1; - case ESE: - if((cell / 5) % 2) - return cell + 7; - else - return cell + 6; - case SE: - if((cell / 5) % 2) - return cell + 6; - else - return cell + 5; - case S: - return cell + 10; - case SW: - if((cell / 5) % 2) - return cell + 5; - else - return cell + 4; - case WSW: - if((cell / 5) % 2) - return cell + 4; - else - return cell + 3; - case W: - return cell - 1; - case WNW: - if((cell / 5) % 2) - return cell - 6; - else - return cell - 7; - case NW: - if((cell / 5) % 2) - return cell - 5; - else - return cell - 6; - case N: - return cell - 10; - case NE: - if((cell / 5) % 2) - return cell - 4; - else - return cell - 5; - case ENE: - if((cell / 5) % 2) - return cell - 3; - else - return cell - 4; - default: - return cell; - } -} - -/* Returns wether the specified cell and direction will land outside - * of the board. Used to determine if a piece is at a legal board - * location or not. - */ -char out_of_bounds(char cell, char dir) { - char i; - switch(dir) { - case E: - return cell % 5 == 4; - case ESE: - i = cell % 10; - return i == 4 || i == 8 || i == 9 || cell >= 45; - case SE: - return cell % 10 == 9 || cell >= 45; - case S: - return cell >= 40; - case SW: - return cell % 10 == 0 || cell >= 45; - case WSW: - i = cell % 10; - return i == 0 || i == 1 || i == 5 || cell >= 45; - case W: - return cell % 5 == 0; - case WNW: - i = cell % 10; - return i == 0 || i == 1 || i == 5 || cell < 5; - case NW: - return cell % 10 == 0 || cell < 5; - case N: - return cell < 10; - case NE: - return cell % 10 == 9 || cell < 5; - case ENE: - i = cell % 10; - return i == 4 || i == 8 || i == 9 || cell < 5; - default: - return FALSE; - } -} - -/* Rotate a piece 60 degrees clockwise */ -void rotate_piece(int piece) { - int i; - for(i = 0; i < 4; i++) - piece_def[piece][i] = rotate(piece_def[piece][i]); -} - -/* Flip a piece along the horizontal axis */ -void flip_piece(int piece) { - int i; - for(i = 0; i < 4; i++) - piece_def[piece][i] = flip(piece_def[piece][i]); -} - -/* Convenience function to quickly calculate all of the indices for a piece */ -void calc_cell_indices(char *cell, int piece, char index) { - cell[0] = index; - cell[1] = shift(cell[0], piece_def[piece][0]); - cell[2] = shift(cell[1], piece_def[piece][1]); - cell[3] = shift(cell[2], piece_def[piece][2]); - cell[4] = shift(cell[3], piece_def[piece][3]); -} - -/* Convenience function to quickly calculate if a piece fits on the board */ -int cells_fit_on_board(char *cell, int piece) { - return (!out_of_bounds(cell[0], piece_def[piece][0]) && - !out_of_bounds(cell[1], piece_def[piece][1]) && - !out_of_bounds(cell[2], piece_def[piece][2]) && - !out_of_bounds(cell[3], piece_def[piece][3])); -} - -/* Returns the lowest index of the cells of a piece. - * I use the lowest index that a piece occupies as the index for looking up - * the piece in the solve function. - */ -char minimum_of_cells(char *cell) { - char minimum = cell[0]; - minimum = cell[1] < minimum ? cell[1] : minimum; - minimum = cell[2] < minimum ? cell[2] : minimum; - minimum = cell[3] < minimum ? cell[3] : minimum; - minimum = cell[4] < minimum ? cell[4] : minimum; - return minimum; -} - -/* Calculate the lowest possible open cell if the piece is placed on the board. - * Used to later reduce the amount of time searching for open cells in the - * solve function. - */ -char first_empty_cell(char *cell, char minimum) { - char first_empty = minimum; - while(first_empty == cell[0] || first_empty == cell[1] || - first_empty == cell[2] || first_empty == cell[3] || - first_empty == cell[4]) - first_empty++; - return first_empty; -} - -/* Generate the unsigned long long int that will later be anded with the - * board to determine if it fits. - */ -unsigned long long bitmask_from_cells(char *cell) { - unsigned long long piece_mask = 0ULL; - int i; - for(i = 0; i < 5; i++) - piece_mask |= 1ULL << cell[i]; - return piece_mask; -} - -/* Record the piece and other important information in arrays that will - * later be used by the solve function. - */ -void record_piece(int piece, int minimum, char first_empty, - unsigned long long piece_mask) { - pieces[piece][minimum][piece_counts[piece][minimum]] = piece_mask; - next_cell[piece][minimum][piece_counts[piece][minimum]] = first_empty; - piece_counts[piece][minimum]++; -} - - -/* Fill the entire board going cell by cell. If any cells are "trapped" - * they will be left alone. - */ -void fill_contiguous_space(char *board, int index) { - if(board[index] == 1) - return; - board[index] = 1; - if(!out_of_bounds(index, E)) - fill_contiguous_space(board, shift(index, E)); - if(!out_of_bounds(index, SE)) - fill_contiguous_space(board, shift(index, SE)); - if(!out_of_bounds(index, SW)) - fill_contiguous_space(board, shift(index, SW)); - if(!out_of_bounds(index, W)) - fill_contiguous_space(board, shift(index, W)); - if(!out_of_bounds(index, NW)) - fill_contiguous_space(board, shift(index, NW)); - if(!out_of_bounds(index, NE)) - fill_contiguous_space(board, shift(index, NE)); -} - - -/* To thin the number of pieces, I calculate if any of them trap any empty - * cells at the edges. There are only a handful of exceptions where the - * the board can be solved with the trapped cells. For example: piece 8 can - * trap 5 cells in the corner, but piece 3 can fit in those cells, or piece 0 - * can split the board in half where both halves are viable. - */ -int has_island(char *cell, int piece) { - char temp_board[50]; - char c; - int i; - for(i = 0; i < 50; i++) - temp_board[i] = 0; - for(i = 0; i < 5; i++) - temp_board[((int)cell[i])] = 1; - i = 49; - while(temp_board[i] == 1) - i--; - fill_contiguous_space(temp_board, i); - c = 0; - for(i = 0; i < 50; i++) - if(temp_board[i] == 0) - c++; - if(c == 0 || (c == 5 && piece == 8) || (c == 40 && piece == 8) || - (c % 5 == 0 && piece == 0)) - return FALSE; - else - return TRUE; -} - - -/* Calculate all six rotations of the specified piece at the specified index. - * We calculate only half of piece 3's rotations. This is because any solution - * found has an identical solution rotated 180 degrees. Thus we can reduce the - * number of attempted pieces in the solve algorithm by not including the 180- - * degree-rotated pieces of ONE of the pieces. I chose piece 3 because it gave - * me the best time ;) - */ - void calc_six_rotations(char piece, char index) { - char rotation, cell[5]; - char minimum, first_empty; - unsigned long long piece_mask; - - for(rotation = 0; rotation < 6; rotation++) { - if(piece != 3 || rotation < 3) { - calc_cell_indices(cell, piece, index); - if(cells_fit_on_board(cell, piece) && !has_island(cell, piece)) { - minimum = minimum_of_cells(cell); - first_empty = first_empty_cell(cell, minimum); - piece_mask = bitmask_from_cells(cell); - record_piece(piece, minimum, first_empty, piece_mask); - } - } - rotate_piece(piece); - } -} - -/* Calculate every legal rotation for each piece at each board location. */ -void calc_pieces(void) { - char piece, index; - - for(piece = 0; piece < 10; piece++) { - for(index = 0; index < 50; index++) { - calc_six_rotations(piece, index); - flip_piece(piece); - calc_six_rotations(piece, index); - } - } -} - - - -/* Calculate all 32 possible states for a 5-bit row and all rows that will - * create islands that follow any of the 32 possible rows. These pre- - * calculated 5-bit rows will be used to find islands in a partially solved - * board in the solve function. - */ -#define ROW_MASK 0x1F -#define TRIPLE_MASK 0x7FFF -char all_rows[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; -int bad_even_rows[32][32]; -int bad_odd_rows[32][32]; -int bad_even_triple[32768]; -int bad_odd_triple[32768]; - -int rows_bad(char row1, char row2, int even) { - /* even is referring to row1 */ - int i, in_zeroes, group_okay; - char block, row2_shift; - /* Test for blockages at same index and shifted index */ - if(even) - row2_shift = ((row2 << 1) & ROW_MASK) | 0x01; - else - row2_shift = (row2 >> 1) | 0x10; - block = ((row1 ^ row2) & row2) & ((row1 ^ row2_shift) & row2_shift); - /* Test for groups of 0's */ - in_zeroes = FALSE; - group_okay = FALSE; - for(i = 0; i < 5; i++) { - if(row1 & (1 << i)) { - if(in_zeroes) { - if(!group_okay) - return TRUE; - in_zeroes = FALSE; - group_okay = FALSE; - } - } else { - if(!in_zeroes) - in_zeroes = TRUE; - if(!(block & (1 << i))) - group_okay = TRUE; - } - } - if(in_zeroes) - return !group_okay; - else - return FALSE; -} - -/* Check for cases where three rows checked sequentially cause a false - * positive. One scenario is when 5 cells may be surrounded where piece 5 - * or 7 can fit. The other scenario is when piece 2 creates a hook shape. - */ -int triple_is_okay(char row1, char row2, char row3, int even) { - if(even) { - /* There are four cases: - * row1: 00011 00001 11001 10101 - * row2: 01011 00101 10001 10001 - * row3: 011?? 00110 ????? ????? - */ - return ((row1 == 0x03) && (row2 == 0x0B) && ((row3 & 0x1C) == 0x0C)) || - ((row1 == 0x01) && (row2 == 0x05) && (row3 == 0x06)) || - ((row1 == 0x19) && (row2 == 0x11)) || - ((row1 == 0x15) && (row2 == 0x11)); - } else { - /* There are two cases: - * row1: 10011 10101 - * row2: 10001 10001 - * row3: ????? ????? - */ - return ((row1 == 0x13) && (row2 == 0x11)) || - ((row1 == 0x15) && (row2 == 0x11)); - } -} - - -void calc_rows(void) { - int row1, row2, row3; - int result1, result2; - for(row1 = 0; row1 < 32; row1++) { - for(row2 = 0; row2 < 32; row2++) { - bad_even_rows[row1][row2] = rows_bad(row1, row2, TRUE); - bad_odd_rows[row1][row2] = rows_bad(row1, row2, FALSE); - } - } - for(row1 = 0; row1 < 32; row1++) { - for(row2 = 0; row2 < 32; row2++) { - for(row3 = 0; row3 < 32; row3++) { - result1 = bad_even_rows[row1][row2]; - result2 = bad_odd_rows[row2][row3]; - if(result1 == FALSE && result2 == TRUE - && triple_is_okay(row1, row2, row3, TRUE)) - bad_even_triple[row1+(row2*32)+(row3*1024)] = FALSE; - else - bad_even_triple[row1+(row2*32)+(row3*1024)] = result1 || result2; - - result1 = bad_odd_rows[row1][row2]; - result2 = bad_even_rows[row2][row3]; - if(result1 == FALSE && result2 == TRUE - && triple_is_okay(row1, row2, row3, FALSE)) - bad_odd_triple[row1+(row2*32)+(row3*1024)] = FALSE; - else - bad_odd_triple[row1+(row2*32)+(row3*1024)] = result1 || result2; - } - } - } -} - - - -/* Calculate islands while solving the board. - */ -int boardHasIslands(char cell) { - /* Too low on board, don't bother checking */ - if(cell >= 40) - return FALSE; - int current_triple = (board >> ((cell / 5) * 5)) & TRIPLE_MASK; - if((cell / 5) % 2) - return bad_odd_triple[current_triple]; - else - return bad_even_triple[current_triple]; -} - - -/* The recursive solve algorithm. Try to place each permutation in the upper- - * leftmost empty cell. Mark off available pieces as it goes along. - * Because the board is a bit mask, the piece number and bit mask must be saved - * at each successful piece placement. This data is used to create a 50 char - * array if a solution is found. - */ -short avail = 0x03FF; -char sol_nums[10]; -unsigned long long sol_masks[10]; -signed char solutions[2100][50]; -int solution_count = 0; -int max_solutions = 2100; - -void record_solution(void) { - int sol_no, index; - unsigned long long sol_mask; - for(sol_no = 0; sol_no < 10; sol_no++) { - sol_mask = sol_masks[sol_no]; - for(index = 0; index < 50; index++) { - if(sol_mask & 1ULL) { - solutions[solution_count][index] = sol_nums[sol_no]; - /* Board rotated 180 degrees is a solution too! */ - solutions[solution_count+1][49-index] = sol_nums[sol_no]; - } - sol_mask = sol_mask >> 1; - } - } - solution_count += 2; -} - -void solve(int depth, int cell) { - int piece, rotation, max_rots; - unsigned long long *piece_mask; - short piece_no_mask; - - if(solution_count >= max_solutions) - return; - - while(board & (1ULL << cell)) - cell++; - - for(piece = 0; piece < 10; piece++) { - piece_no_mask = 1 << piece; - if(!(avail & piece_no_mask)) - continue; - avail ^= piece_no_mask; - max_rots = piece_counts[piece][cell]; - piece_mask = pieces[piece][cell]; - for(rotation = 0; rotation < max_rots; rotation++) { - if(!(board & *(piece_mask + rotation))) { - sol_nums[depth] = piece; - sol_masks[depth] = *(piece_mask + rotation); - if(depth == 9) { - /* Solution found!!!!!11!!ONE! */ - record_solution(); - avail ^= piece_no_mask; - return; - } - board |= *(piece_mask + rotation); - if(!boardHasIslands(next_cell[piece][cell][rotation])) - solve(depth + 1, next_cell[piece][cell][rotation]); - board ^= *(piece_mask + rotation); - } - } - avail ^= piece_no_mask; - } -} - - -/* qsort comparator - used to find first and last solutions */ -int solution_sort(const void *elem1, const void *elem2) { - signed char *char1 = (signed char *) elem1; - signed char *char2 = (signed char *) elem2; - int i = 0; - while(i < 50 && char1[i] == char2[i]) - i++; - return char1[i] - char2[i]; -} - - -/* pretty print a board in the specified hexagonal format */ -void pretty(signed char *b) { - int i; - for(i = 0; i < 50; i += 10) { - printf("%c %c %c %c %c \n %c %c %c %c %c \n", b[i]+'0', b[i+1]+'0', - b[i+2]+'0', b[i+3]+'0', b[i+4]+'0', b[i+5]+'0', b[i+6]+'0', - b[i+7]+'0', b[i+8]+'0', b[i+9]+'0'); - } - printf("\n"); -} -#endif Index: gcc/testsuite/g++.dg/pph/p2pr36533.cc =================================================================== --- gcc/testsuite/g++.dg/pph/p2pr36533.cc (revision 176187) +++ gcc/testsuite/g++.dg/pph/p2pr36533.cc (working copy) @@ -1,3 +1,2 @@ /* { dg-options "-w -fpermissive" } */ -// pph asm xdiff -#include "c1pr36533.h" +#include "p1pr36533.h" Index: gcc/testsuite/g++.dg/pph/x6dynarray5.h =================================================================== --- gcc/testsuite/g++.dg/pph/x6dynarray5.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/x6dynarray5.h (working copy) @@ -1,3 +1,6 @@ +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-bogus "a0dynarray-dfn1b.hi:3:19: error: there are no arguments to 'alloc' that depend on a template parameter, so a declaration of 'alloc' must be available" "" { xfail *-*-* } 0 } + #ifndef X6DYNARRAY5_H #define X6DYNARRAY5_H Index: gcc/testsuite/g++.dg/pph/c1eabi1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c1eabi1.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/c1eabi1.cc (working copy) @@ -1,4 +1,5 @@ // { dg-options "-w -fpermissive" } +// pph asm xdiff #include "c0eabi1.h" Index: gcc/testsuite/g++.dg/pph/c4eabi1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c4eabi1.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/c4eabi1.cc (working copy) @@ -1,191 +0,0 @@ -// { dg-options "-w -fpermissive" } -// pph asm xdiff - -#include "c4eabi1.h" - -int main () { - unsigned char bytes[256]; - int i, j, k, n; - int *result; - - /* Table 2. Double-precision floating-point arithmetic. */ - deq (__aeabi_dadd (dzero, done), done); - deq (__aeabi_dadd (done, done), dtwo); - deq (__aeabi_ddiv (dminus_four, dminus_two), dtwo); - deq (__aeabi_ddiv (dminus_two, dtwo), dminus_one); - deq (__aeabi_dmul (dtwo, dtwo), dfour); - deq (__aeabi_dmul (dminus_one, dminus_two), dtwo); - deq (__aeabi_dneg (dminus_one), done); - deq (__aeabi_dneg (dfour), dminus_four); - deq (__aeabi_drsub (done, dzero), dminus_one); - deq (__aeabi_drsub (dtwo, dminus_two), dminus_four); - deq (__aeabi_dsub (dzero, done), dminus_one); - deq (__aeabi_dsub (dminus_two, dtwo), dminus_four); - - /* Table 3. Double-precision floating-point comparisons. */ - ieq (__aeabi_dcmpeq (done, done), 1); - ieq (__aeabi_dcmpeq (done, dzero), 0); - ieq (__aeabi_dcmpeq (dNaN, dzero), 0); - ieq (__aeabi_dcmpeq (dNaN, dNaN), 0); - - ieq (__aeabi_dcmplt (dzero, done), 1); - ieq (__aeabi_dcmplt (done, dzero), 0); - ieq (__aeabi_dcmplt (dzero, dzero), 0); - ieq (__aeabi_dcmplt (dzero, dNaN), 0); - ieq (__aeabi_dcmplt (dNaN, dNaN), 0); - - ieq (__aeabi_dcmple (dzero, done), 1); - ieq (__aeabi_dcmple (done, dzero), 0); - ieq (__aeabi_dcmple (dzero, dzero), 1); - ieq (__aeabi_dcmple (dzero, dNaN), 0); - ieq (__aeabi_dcmple (dNaN, dNaN), 0); - - ieq (__aeabi_dcmpge (dzero, done), 0); - ieq (__aeabi_dcmpge (done, dzero), 1); - ieq (__aeabi_dcmpge (dzero, dzero), 1); - ieq (__aeabi_dcmpge (dzero, dNaN), 0); - ieq (__aeabi_dcmpge (dNaN, dNaN), 0); - - ieq (__aeabi_dcmpgt (dzero, done), 0); - ieq (__aeabi_dcmpgt (done, dzero), 1); - ieq (__aeabi_dcmplt (dzero, dzero), 0); - ieq (__aeabi_dcmpgt (dzero, dNaN), 0); - ieq (__aeabi_dcmpgt (dNaN, dNaN), 0); - - ieq (__aeabi_dcmpun (done, done), 0); - ieq (__aeabi_dcmpun (done, dzero), 0); - ieq (__aeabi_dcmpun (dNaN, dzero), 1); - ieq (__aeabi_dcmpun (dNaN, dNaN), 1); - - /* Table 4. Single-precision floating-point arithmetic. */ - feq (__aeabi_fadd (fzero, fone), fone); - feq (__aeabi_fadd (fone, fone), ftwo); - feq (__aeabi_fdiv (fminus_four, fminus_two), ftwo); - feq (__aeabi_fdiv (fminus_two, ftwo), fminus_one); - feq (__aeabi_fmul (ftwo, ftwo), ffour); - feq (__aeabi_fmul (fminus_one, fminus_two), ftwo); - feq (__aeabi_fneg (fminus_one), fone); - feq (__aeabi_fneg (ffour), fminus_four); - feq (__aeabi_frsub (fone, fzero), fminus_one); - feq (__aeabi_frsub (ftwo, fminus_two), fminus_four); - feq (__aeabi_fsub (fzero, fone), fminus_one); - feq (__aeabi_fsub (fminus_two, ftwo), fminus_four); - - /* Table 5. Single-precision floating-point comparisons. */ - ieq (__aeabi_fcmpeq (fone, fone), 1); - ieq (__aeabi_fcmpeq (fone, fzero), 0); - ieq (__aeabi_fcmpeq (fNaN, fzero), 0); - ieq (__aeabi_fcmpeq (fNaN, fNaN), 0); - - ieq (__aeabi_fcmplt (fzero, fone), 1); - ieq (__aeabi_fcmplt (fone, fzero), 0); - ieq (__aeabi_fcmplt (fzero, fzero), 0); - ieq (__aeabi_fcmplt (fzero, fNaN), 0); - ieq (__aeabi_fcmplt (fNaN, fNaN), 0); - - ieq (__aeabi_fcmple (fzero, fone), 1); - ieq (__aeabi_fcmple (fone, fzero), 0); - ieq (__aeabi_fcmple (fzero, fzero), 1); - ieq (__aeabi_fcmple (fzero, fNaN), 0); - ieq (__aeabi_fcmple (fNaN, fNaN), 0); - - ieq (__aeabi_fcmpge (fzero, fone), 0); - ieq (__aeabi_fcmpge (fone, fzero), 1); - ieq (__aeabi_fcmpge (fzero, fzero), 1); - ieq (__aeabi_fcmpge (fzero, fNaN), 0); - ieq (__aeabi_fcmpge (fNaN, fNaN), 0); - - ieq (__aeabi_fcmpgt (fzero, fone), 0); - ieq (__aeabi_fcmpgt (fone, fzero), 1); - ieq (__aeabi_fcmplt (fzero, fzero), 0); - ieq (__aeabi_fcmpgt (fzero, fNaN), 0); - ieq (__aeabi_fcmpgt (fNaN, fNaN), 0); - - ieq (__aeabi_fcmpun (fone, fone), 0); - ieq (__aeabi_fcmpun (fone, fzero), 0); - ieq (__aeabi_fcmpun (fNaN, fzero), 1); - ieq (__aeabi_fcmpun (fNaN, fNaN), 1); - - /* Table 6. Floating-point to integer conversions. */ - ieq (__aeabi_d2iz (dminus_one), -1); - ueq (__aeabi_d2uiz (done), 1); - leq (__aeabi_d2lz (dminus_two), -2LL); - uleq (__aeabi_d2ulz (dfour), 4LL); - ieq (__aeabi_f2iz (fminus_one), -1); - ueq (__aeabi_f2uiz (fone), 1); - leq (__aeabi_f2lz (fminus_two), -2LL); - uleq (__aeabi_f2ulz (ffour), 4LL); - - /* Table 7. Conversions between floating types. */ - feq (__aeabi_d2f (dtwo), ftwo); - deq (__aeabi_f2d (fminus_four), dminus_four); - - /* Table 8. Integer to floating-point conversions. */ - deq (__aeabi_i2d (-1), dminus_one); - deq (__aeabi_ui2d (2), dtwo); - deq (__aeabi_l2d (-1), dminus_one); - deq (__aeabi_ul2d (2ULL), dtwo); - feq (__aeabi_i2f (-1), fminus_one); - feq (__aeabi_ui2f (2), ftwo); - feq (__aeabi_l2f (-1), fminus_one); - feq (__aeabi_ul2f (2ULL), ftwo); - - /* Table 9. Long long functions. */ - leq (__aeabi_lmul (4LL, -1LL), -4LL); - leq (__aeabi_llsl (2LL, 1), 4LL); - leq (__aeabi_llsr (-1LL, 63), 1); - leq (__aeabi_lasr (-1LL, 63), -1); - - result = lcmp_results; - for (i = 0; i < NUM_CMP_VALUES; i++) - for (j = 0; j < NUM_CMP_VALUES; j++) - for (k = 0; k < NUM_CMP_VALUES; k++) - for (n = 0; n < NUM_CMP_VALUES; n++) - { - ieq (signof (__aeabi_lcmp - (((long long)cmp_val[i] << 32) | cmp_val[k], - ((long long)cmp_val[j] << 32) | cmp_val[n])), - *result); - result++; - } - result = ulcmp_results; - for (i = 0; i < NUM_CMP_VALUES; i++) - for (j = 0; j < NUM_CMP_VALUES; j++) - for (k = 0; k < NUM_CMP_VALUES; k++) - for (n = 0; n < NUM_CMP_VALUES; n++) - { - ieq (signof (__aeabi_ulcmp - (((long long)cmp_val[i] << 32) | cmp_val[k], - ((long long)cmp_val[j] << 32) | cmp_val[n])), - *result); - result++; - } - - ieq (__aeabi_idiv (-550, 11), -50); - ueq (__aeabi_uidiv (4000000000U, 1000000U), 4000U); - - for (i = 0; i < 256; i++) - bytes[i] = i; - -#ifdef __ARMEB__ - ieq (__aeabi_uread4 (bytes + 1), 0x01020304U); - leq (__aeabi_uread8 (bytes + 3), 0x030405060708090aLL); - ieq (__aeabi_uwrite4 (0x66778899U, bytes + 5), 0x66778899U); - leq (__aeabi_uwrite8 (0x2030405060708090LL, bytes + 15), - 0x2030405060708090LL); -#else - ieq (__aeabi_uread4 (bytes + 1), 0x04030201U); - leq (__aeabi_uread8 (bytes + 3), 0x0a09080706050403LL); - ieq (__aeabi_uwrite4 (0x99887766U, bytes + 5), 0x99887766U); - leq (__aeabi_uwrite8 (0x9080706050403020LL, bytes + 15), - 0x9080706050403020LL); -#endif - - for (i = 0; i < 4; i++) - ieq (bytes[5 + i], (6 + i) * 0x11); - - for (i = 0; i < 8; i++) - ieq (bytes[15 + i], (2 + i) * 0x10); - - exit (0); -} Index: gcc/testsuite/g++.dg/pph/c2pr36533.cc =================================================================== --- gcc/testsuite/g++.dg/pph/c2pr36533.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/c2pr36533.cc (working copy) @@ -1,2 +0,0 @@ -/* { dg-options "-w -fpermissive" } */ -#include "c1pr36533.h" Index: gcc/testsuite/g++.dg/pph/c1pr36533.h =================================================================== --- gcc/testsuite/g++.dg/pph/c1pr36533.h (revision 176223) +++ gcc/testsuite/g++.dg/pph/c1pr36533.h (working copy) @@ -1,16 +0,0 @@ -/* PR target/36533 */ -/* { dg-options "-w -fpermissive" } */ - -#ifndef C1PR36533_H -#define C1PR36533_H - -#include <string.h> -#include <sys/mman.h> - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -#include "a0pr36533.h" - -#endif Index: gcc/testsuite/g++.dg/pph/x1dynarray1.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1dynarray1.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/x1dynarray1.cc (working copy) @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do link } // { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } #include "x0dynarray1.h" Index: gcc/testsuite/g++.dg/pph/x1dynarray2b.cc =================================================================== --- gcc/testsuite/g++.dg/pph/x1dynarray2b.cc (revision 176223) +++ gcc/testsuite/g++.dg/pph/x1dynarray2b.cc (working copy) @@ -1,4 +1,5 @@ -// { dg-do run } +// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } } +// { dg-do link } #include "x0dynarray2.h"