diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2008-08-16 18:19:56 +0000 |
---|---|---|
committer | H.J. Lu <hongjiu.lu@intel.com> | 2008-08-16 18:19:56 +0000 |
commit | c0b7727f94742b87af19bd3bedb0a975f82b7334 (patch) | |
tree | 28a9cd64c3bbd451068922845e688c306a79f325 | |
parent | fb2a30ee6c0c63ad796d5d283dc2d850cabc07d9 (diff) |
Merged with trunk at revision 139152.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ix86/avx@139153 138bc75d-0d04-0410-961f-82ee72b054a4
73 files changed, 5223 insertions, 586 deletions
diff --git a/ChangeLog b/ChangeLog index 156f55d9b30..e5bb91b1ccd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-16 Nicolas Roche <roche@adacore.com> + + * Makefile.tpl: Add BOOT_ADAFLAGS. + * Makefile.in: Regenerate. + 2008-08-09 Richard Sandiford <rdsandiford@googlemail.com> * configure.ac (mips*-*-*linux*, mips*-*-gnu*): Use mt-mips-gnu. @@ -3668,7 +3673,7 @@ of libf2c. * configure, Makefile.in: Regenerate. -2004-05-13 Tobias SchlÃÂüter <tobi@gcc.gnu.org> +2004-05-13 Tobias Schl���¼ter <tobi@gcc.gnu.org> * MAINTAINERS (Write After Approval): Add myself. diff --git a/Makefile.in b/Makefile.in index d9ef0681497..2ede05810ee 100644 --- a/Makefile.in +++ b/Makefile.in @@ -291,6 +291,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # here so that they can be overridden by Makefile fragments. BOOT_CFLAGS= -g -O2 BOOT_LDFLAGS= +BOOT_ADAFLAGS=-gnatpg -gnata BISON = @BISON@ YACC = @YACC@ diff --git a/Makefile.tpl b/Makefile.tpl index 1f0c318012f..a9dfd3e2af4 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -294,6 +294,7 @@ BUILD_PREFIX_1 = @BUILD_PREFIX_1@ # here so that they can be overridden by Makefile fragments. BOOT_CFLAGS= -g -O2 BOOT_LDFLAGS= +BOOT_ADAFLAGS=-gnatpg -gnata BISON = @BISON@ YACC = @YACC@ diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 73b478e6558..f7218cdd088 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,45 @@ +2008-08-16 Andy Hutchinson <hutchinsonandy@aim.com> + + * config/avr/avr.c (avr_override_options): Reduce value of + PARAM_INLINE_CALL_COST. + +2008-08-15 Eric Botcazou <ebotcazou@adacore.com> + + * expr.c (expand_expr_real_1) <VIEW_CONVERT_EXPR>: When converting + to BLKmode, try to fetch an inner memory reference. Use 'mode' in + lieu of TYPE_MODE (type) throughout. + +2008-08-15 Joseph Myers <joseph@codesourcery.com> + + * config/arm/arm.c (add_minipool_backward_ref): Check for + 8-byte-aligned entries in second case of forcing insertion after a + particular entry. Change third case to avoid inserting + non-8-byte-aligned entries before 8-byte-aligned ones. + +2008-08-15 Richard Guenther <rguenther@suse.de> + + * tree-ssa-ccp.c (maybe_fold_offset_to_reference): Do not + strip components for unknown size accesses. + +2008-08-15 Wolfgang Gellerich <gellerich@de.ibm.com> + + * config/s390/2097.md New file. + * config/s390/s390.md ("z10prop" attribute): Define none, + z10_super, z10_super_E1, z10_super_A1, z10_super_c, + z10_super_c_E1, z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1, + z10_rec, z10_fr, z10_fr_A3, z10_fr_E1, z10_c, and z10_cobra as + possible values and apply them to insns as appropriate. + ("type" attribute): Removed itof and added ftrunctf,ftruncdf, + ftruncsd, ftruncdd, itoftf, itofdf, itofsf, itofdd, itoftd, + fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd, fsimpdd, + fsimpsd, fsimptd, fstoredd, fstoresd, ftoidfp as possible + values. + ("bfp" mode attribute): Removed. Every occurence replaced + with <mode>. + * config/s390/s390.c (struct "z10_cost"): Updated entries. + * config/s390/2084.md (insn_reservation "x_itof"): Updated + type attribute. + 2008-08-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/28152 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 657795f131f..64863609694 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20080814 +20080816 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index bf3c7dd903d..39f8cd17ae9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -11,8 +11,8 @@ 2008-08-12 Danny Smith <danyssmith@users.sourceforge.net> - * gcc-interface/Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS) [WINDOWS]: Remove - duplicate s-win32.o. Add s-winext.o. + * gcc-interface/Makefile.in (EXTRA_GNATRTL_NONTASKING_OBJS) [WINDOWS]: + Remove duplicate s-win32.o. Add s-winext.o. 2008-08-12 Danny Smith <danyssmith@users.sourceforge.net> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a3a49f7242b..61b19696bab 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -8772,17 +8772,20 @@ add_minipool_backward_ref (Mfix *fix) its maximum address (which can happen if we have re-located a forwards fix); force the new fix to come after it. */ - min_mp = mp; - min_address = mp->min_address + fix->fix_size; + if (ARM_DOUBLEWORD_ALIGN + && fix->fix_size >= 8 && mp->fix_size < 8) + return NULL; + else + { + min_mp = mp; + min_address = mp->min_address + fix->fix_size; + } } - /* If we are inserting an 8-bytes aligned quantity and - we have not already found an insertion point, then - make sure that all such 8-byte aligned quantities are - placed at the start of the pool. */ + /* Do not insert a non-8-byte aligned quantity before 8-byte + aligned quantities. */ else if (ARM_DOUBLEWORD_ALIGN - && min_mp == NULL - && fix->fix_size >= 8 - && mp->fix_size < 8) + && fix->fix_size < 8 + && mp->fix_size >= 8) { min_mp = mp; min_address = mp->min_address + fix->fix_size; diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 5fbf57189ec..dba224db886 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -43,6 +43,7 @@ #include "tm_p.h" #include "target.h" #include "target-def.h" +#include "params.h" #include "df.h" /* Maximal allowed offset for an address in the LD command */ @@ -348,6 +349,9 @@ avr_override_options (void) flag_delete_null_pointer_checks = 0; + if (!PARAM_SET_P (PARAM_INLINE_CALL_COST)) + set_param_value ("inline-call-cost", 5); + for (t = avr_mcu_types; t->name; t++) if (strcmp (t->name, avr_mcu_name) == 0) break; diff --git a/gcc/config/s390/2084.md b/gcc/config/s390/2084.md index 0c42f187e9c..d3c92722bd9 100644 --- a/gcc/config/s390/2084.md +++ b/gcc/config/s390/2084.md @@ -243,7 +243,7 @@ (define_insn_reservation "x_itof" 7 (and (eq_attr "cpu" "z990,z9_109") - (eq_attr "type" "itof")) + (eq_attr "type" "itoftf,itofdf,itofsf")) "x_e1_t*3,x-wr-fp") (define_bypass 1 "x_fsimpdf" "x_fstoredf") diff --git a/gcc/config/s390/2097.md b/gcc/config/s390/2097.md new file mode 100644 index 00000000000..f27302e0a2b --- /dev/null +++ b/gcc/config/s390/2097.md @@ -0,0 +1,764 @@ +;; Scheduling description for z10 (cpu 2097). +;; Copyright (C) 2008 Free Software Foundation, Inc. +;; Contributed by Wolfgang Gellerich (gellerich@de.ibm.com). + + +; General naming conventions used in this file: +; - The two pipelines are called S and T, respectively. +; - A name ending "_S" or "_T" indicates that something happens in +; (or belongs to) this pipeline. +; - A name ending "_ANY" indicates that something happens in (or belongs +; to) either of the two pipelines. +; - A name ending "_BOTH" indicates that something happens in (or belongs +; to) both pipelines. + + +;; Automaton and components. + +(define_automaton "z10_cpu") + +(define_cpu_unit "z10_e1_S, z10_e1_T" "z10_cpu") +(define_reservation "z10_e1_ANY" "(z10_e1_S | z10_e1_T)") +(define_reservation "z10_e1_BOTH" "(z10_e1_S + z10_e1_T)") + + +; Both pipelines can execute a branch instruction, and branch +; instructions can be grouped with all other groupable instructions +; but not with a second branch instruction. + +(define_cpu_unit "z10_branch_ANY" "z10_cpu") + +(define_insn_reservation "z10_branch" 4 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "branch")) + "z10_branch_ANY + z10_e1_ANY, z10_Gate_ANY") + + +; Z10 operand and result forwarding. + +; Instructions marked with the attributes as z10_fwd or z10_fr can +; forward a value they load from one of their operants into a register +; if the instruction in the second pipeline reads the same register. +; The second operation must be superscalar. Instructions marked as +; z10_rec or z10_fr can receive a value they read from a register is +; this register gets updated by an instruction in the first pipeline. +; The first instruction must be superscalar. + + +; Forwarding from z10_fwd and z10_fr to z10_super. + +(define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \ + z10_load_fwd, z10_load_fwd_A3, \ + z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \ + z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \ + z10_other_fwd_E1, z10_lr_fr, z10_lr_fr_E1, \ + z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \ + z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \ + z10_int_fr_A3" + "z10_other_super, z10_other_super_c_E1, z10_other_super_E1, \ + z10_int_super, z10_int_super_E1, \ + z10_lr, z10_store_super") + + +; Forwarding from z10_super to frz10_ and z10_rec. + +(define_bypass 0 "z10_other_super, z10_other_super_E1, z10_other_super_c_E1, \ + z10_int_super, z10_int_super_E1, \ + z10_larl_super_E1, z10_larl_super, \ + z10_store_super" + "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \ + z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \ + z10_other_fr_E1, z10_store_rec") + + +; Forwarding from z10_fwd and z10_fr to z10_rec and z10_fr. + +(define_bypass 0 "z10_la_fwd, z10_la_fwd_A1, z10_larl_fwd, z10_larl_fwd_A3, \ + z10_load_fwd, z10_load_fwd_A3, \ + z10_other_fwd, z10_other_fwd_A1, z10_other_fwd_A3, \ + z10_other_fr, z10_other_fr_A3, z10_other_fr_E1, \ + z10_other_fwd_E1, \ + z10_lr_fr, z10_lr_fr_E1, \ + z10_int_fwd, z10_int_fwd_A1, z10_int_fwd_A3, \ + z10_int_fwd_E1, z10_int_fr, z10_int_fr_E1, \ + z10_int_fr_A3" + "z10_int_fr, z10_int_fr_E1, z10_int_fr_A3, \ + z10_other_fr, z10_other_fr_A3, z10_lr_fr, z10_lr_fr_E1, \ + z10_other_fr_E1, z10_store_rec") + + +; +; Simple insns +; + +; Here is the cycle diagram for FXU-executed instructions: +; ... A1 A2 A3 E1 P1 P2 P3 R0 ... +; ^ ^ ^ +; | | updated GPR is available +; | write to GPR +; instruction reads GPR during this cycle + + +; Variants of z10_int follow. + +(define_insn_reservation "z10_int" 6 + (and (and (eq_attr "cpu" "z10") + (eq_attr "type" "integer")) + (and (eq_attr "atype" "reg") + (and (and (eq_attr "z10prop" "!z10_super") + (eq_attr "z10prop" "!z10_super_c")) + (and (and (and (and (eq_attr "z10prop" "!z10_super_E1") + (eq_attr "z10prop" "!z10_super_c_E1")) + (eq_attr "z10prop" "!z10_fwd")) + (and (eq_attr "z10prop" "!z10_fwd_A1") + (eq_attr "z10prop" "!z10_fwd_A3"))) + (and (and (eq_attr "z10prop" "!z10_fwd_E1") + (eq_attr "z10prop" "!z10_fr")) + (and (eq_attr "z10prop" "!z10_fr_E1") + (eq_attr "z10prop" "!z10_fr_A3"))))))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_super" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (ior (eq_attr "z10prop" "z10_super") + (eq_attr "z10prop" "z10_super_c"))))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_super_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (ior (eq_attr "z10prop" "z10_super_E1") + (eq_attr "z10prop" "z10_super_c_E1"))))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fwd" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fwd")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fwd_A1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fwd_A1")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fwd_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fwd_A3")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fwd_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fwd_E1")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fr" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fr")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fr_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fr_E1")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_int_fr_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (and (eq_attr "atype" "reg") + (eq_attr "z10prop" "z10_fr_A3")))) + "z10_e1_ANY, z10_Gate_ANY") + +; END of z10_int variants + + +(define_insn_reservation "z10_agen" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "integer") + (eq_attr "atype" "agen"))) + "z10_e1_ANY, z10_Gate_ANY") + + +(define_insn_reservation "z10_lr" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "lr") + (and (eq_attr "z10prop" "!z10_fr") + (eq_attr "z10prop" "!z10_fr_E1")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_lr_fr" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "lr") + (eq_attr "z10prop" "z10_fr"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + +(define_insn_reservation "z10_lr_fr_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "lr") + (eq_attr "z10prop" "z10_fr_E1"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + + +(define_insn_reservation "z10_la" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "la") + (and (eq_attr "z10prop" "!z10_fwd") + (eq_attr "z10prop" "!z10_fwd_A1")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_la_fwd" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "la") + (eq_attr "z10prop" "z10_fwd"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + +(define_insn_reservation "z10_la_fwd_A1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "la") + (eq_attr "z10prop" "z10_fwd_A1"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + + +; larl-type instructions + +(define_insn_reservation "z10_larl" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (and (eq_attr "z10prop" "!z10_super_A1") + (and (eq_attr "z10prop" "!z10_fwd") + (and (eq_attr "z10prop" "!z10_fwd_A3") + (and (eq_attr "z10prop" "!z10_super") + (eq_attr "z10prop" "!z10_super_c")) + (and (eq_attr "z10prop" "!z10_super_E1") + (eq_attr "z10prop" "!z10_super_c_E1"))))))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_larl_super" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (and (eq_attr "z10prop" "z10_super") + (eq_attr "z10prop" "z10_super_c")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_larl_fwd" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (eq_attr "z10prop" "z10_fwd"))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_larl_fwd_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (eq_attr "z10prop" "z10_fwd_A3"))) + "z10_e1_ANY, z10_Gate_ANY") + + +(define_insn_reservation "z10_larl_A1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (eq_attr "z10prop" "z10_super_A1"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + +(define_insn_reservation "z10_larl_super_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "larl") + (ior (eq_attr "z10prop" "z10_super_E1") + (eq_attr "z10prop" "z10_super_c_E1")))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + + +(define_insn_reservation "z10_load" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "load") + (and (eq_attr "z10prop" "!z10_fwd") + (eq_attr "z10prop" "!z10_fwd_A3")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_load_fwd" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "load") + (eq_attr "z10prop" "z10_fwd"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + +(define_insn_reservation "z10_load_fwd_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "load") + (eq_attr "z10prop" "z10_fwd_A3"))) + "z10_e1_ANY, z10_Gate_ANY") +; "z10_e1_ANY") + +(define_insn_reservation "z10_store" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "store") + (and (eq_attr "z10prop" "!z10_rec") + (and (eq_attr "z10prop" "!z10_super") + (eq_attr "z10prop" "!z10_super_c"))))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_store_super" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "store") + (ior (eq_attr "z10prop" "z10_super") + (eq_attr "z10prop" "z10_super_c")))) + "z10_e1_ANY, z10_Gate_ANY") + +(define_insn_reservation "z10_store_rec" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "store") + (eq_attr "z10prop" "z10_rec"))) + "z10_e1_ANY, z10_Gate_ANY") + +; The default_latency is chosen to drain off the pipeline. +(define_insn_reservation "z10_call" 14 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "jsr")) + "z10_e1_BOTH*4, z10_Gate_BOTH") + +; The default latency is for worst case. CS and CSG take one +; cycle only (i.e. latency would be 6). +(define_insn_reservation "z10_sem" 9 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "sem")) + "z10_e1_BOTH*5, z10_Gate_ANY") + +(define_insn_reservation "z10_cs" 6 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "cs")) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_vs" 6 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "vs")) + "z10_e1_BOTH*4, z10_Gate_BOTH") + +; Load and store multiple. Actual number of cycles +; in unknown at compile.time. +(define_insn_reservation "z10_stm" 10 + (and (eq_attr "cpu" "z10") + (ior (eq_attr "type" "stm") + (eq_attr "type" "lm"))) + "z10_e1_BOTH*4, z10_Gate_BOTH") + + +; Subsets of z10_other follow. + +(define_insn_reservation "z10_other" 6 + (and (and (eq_attr "cpu" "z10") + (eq_attr "type" "other")) + (and (and (eq_attr "z10prop" "!z10_fwd") + (eq_attr "z10prop" "!z10_fwd_A1")) + (and (and (and (eq_attr "z10prop" "!z10_fr_A3") + (eq_attr "z10prop" "!z10_fwd_A3")) + (and (eq_attr "z10prop" "!z10_fr") + (eq_attr "z10prop" "!z10_fr_E1"))) + (and (and (and (eq_attr "z10prop" "!z10_super") + (eq_attr "z10prop" "!z10_super_c")) + (eq_attr "z10prop" "!z10_super_c_E1")) + (and (eq_attr "z10prop" "!z10_super_E1") + (eq_attr "z10prop" "!z10_fwd_E1")))))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fr_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fr_E1"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_super_c_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_super_c_E1"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_super_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_super_E1"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fwd_E1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fwd_E1"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fwd" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fwd"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fwd_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fwd_A3"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fwd_A1" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fwd_A1"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fr" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fr"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_fr_A3" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (eq_attr "z10prop" "z10_fr_A3"))) + "z10_e1_BOTH, z10_Gate_BOTH") + +(define_insn_reservation "z10_other_super" 6 + (and (eq_attr "cpu" "z10") + (and (eq_attr "type" "other") + (ior (eq_attr "z10prop" "z10_super") + (eq_attr "z10prop" "z10_super_c")))) + "z10_e1_BOTH, z10_Gate_BOTH") + +; END of z10_other subsets. + + +; +; Floating point insns +; + +; Z10 executes the following integer operations in the BFU pipeline. + +(define_insn_reservation "z10_mul_sidi" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "imulsi,imuldi,imulhi")) + "z10_e1_BOTH, z10_Gate_FP") + +; Some variants take fewer cycles, but that is not relevant here. +(define_insn_reservation "z10_div" 162 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "idiv")) + "z10_e1_BOTH*4, z10_Gate_FP") + + +; BFP multiplication and general instructions + +(define_insn_reservation "z10_fsimpdf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimpdf,fmuldf")) + "z10_e1_BOTH, z10_Gate_FP") +; Wg "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_fsimpsf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimpsf,fmulsf")) + "z10_e1_BOTH, z10_Gate_FP") +; Wg "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_fmultf" 52 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fmultf")) + "z10_e1_BOTH*4, z10_Gate_FP") +; Wg "z10_e1_T*4, z10_Gate_FP") + +(define_insn_reservation "z10_fsimptf" 14 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimptf")) + "z10_e1_BOTH*2, z10_Gate_FP") +; Wg "z10_e1_T*2, z10_Gate_FP") + + +; BFP division + +(define_insn_reservation "z10_fdivtf" 113 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fdivtf")) + "z10_e1_T*4, z10_Gate_FP") + +(define_insn_reservation "z10_fdivdf" 41 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fdivdf")) + "z10_e1_T*4, z10_Gate_FP") + +(define_insn_reservation "z10_fdivsf" 34 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fdivsf")) + "z10_e1_T*4, z10_Gate_FP") + + +; BFP sqrt + +(define_insn_reservation "z10_fsqrtsf" 41 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsqrtsf")) + "z10_e1_T*4, z10_Gate_FP") + +(define_insn_reservation "z10_fsqrtdf" 54 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsqrtdf")) + "z10_e1_T*4, z10_Gate_FP") + +(define_insn_reservation "z10_fsqrtf" 122 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsqrttf")) + "z10_e1_T*4, z10_Gate_FP") + + +; BFP load and store + +(define_insn_reservation "z10_floadtf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "floadtf")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_floaddf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "floaddf")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_floadsf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "floadsf")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_fstoredf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fstoredf,fstoredd")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_fstoresf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fstoresf,fstoresd")) + "z10_e1_T, z10_Gate_FP") + + +; BFP truncate +(define_insn_reservation "z10_ftrunctf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftrunctf")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_ftruncdf" 16 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftruncdf")) + "z10_e1_T, z10_Gate_FP") + + +; Conversion between BFP and int. +(define_insn_reservation "z10_ftoi" 13 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftoi")) + "z10_e1_T, z10_Gate_FP") + +(define_insn_reservation "z10_itoftf" 14 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "itoftf")) + "z10_e1_T*2, z10_Gate_FP") + +(define_insn_reservation "z10_itofsfdf" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "itofdf,itofsf")) + "z10_e1_T, z10_Gate_FP") + + + +; BFP-related bypasses. There is no bypass for extended mode. +(define_bypass 1 "z10_fsimpdf" "z10_fstoredf") +(define_bypass 1 "z10_fsimpsf" "z10_fstoresf") +(define_bypass 1 "z10_floaddf" "z10_fsimpdf, z10_fstoredf, z10_floaddf") +(define_bypass 1 "z10_floadsf" "z10_fsimpsf, z10_fstoresf, z10_floadsf") + + +; +; insn_reservations for DFP instructions. +; + +; Exact number of cycles is not known at compile-time. +(define_insn_reservation "z10_fdivddtd" 40 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fdivdd,fdivtd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_ftruncsd" 38 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftruncsd")) + "z10_e1_BOTH*4,z10_Gate_DFU") + +(define_insn_reservation "z10_ftruncdd" 340 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftruncsd")) + "z10_e1_BOTH*4,z10_Gate_DFU") + +(define_insn_reservation "z10_floaddd" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "floaddd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_floadsd" 12 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "floadsd")) + "z10_e1_BOTH,z10_Gate_DFU") + +; Exact number of cycles is not known at compile-time. +(define_insn_reservation "z10_fmulddtd" 35 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fmuldd,fmultd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_fsimpdd" 17 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimpdd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_fsimpsd" 17 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimpsd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_fsimptd" 18 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "fsimptd")) + "z10_e1_BOTH,z10_Gate_DFU") + +(define_insn_reservation "z10_itofdd" 36 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "itofdd")) + "z10_e1_BOTH*3,z10_Gate_DFU") + +(define_insn_reservation "z10_itoftd" 49 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "itoftd")) + "z10_e1_BOTH*3,z10_Gate_DFU") + +; Exact number of cycles is not known at compile-time. +(define_insn_reservation "z10_ftoidfp" 30 + (and (eq_attr "cpu" "z10") + (eq_attr "type" "ftoidfp")) + "z10_e1_BOTH*3,z10_Gate_DFU") + + +; +; Address-related bypasses +; + +; Here is the cycle diagram for Address-related bypasses: +; ... G1 G2 G3 A0 A1 A2 A3 E1 P1 P2 P3 R0 ... +; ^ ^ ^ ^ ^ +; | | | | E1-type bypasses provide the new addr AFTER this cycle +; | | | A3-type bypasses provide the new addr AFTER this cycle +; | | A1-type bypasses provide the new addr AFTER this cycle +; | AGI resolution, actual USE of address is DURING this cycle +; AGI detection + +(define_bypass 3 "z10_larl_A1, z10_la_fwd_A1, z10_other_fwd_A1, \ + z10_int_fwd_A1" + "z10_agen, z10_la, z10_branch, z10_call, z10_load, \ + z10_store, \ + z10_cs, z10_stm, z10_other" + "s390_agen_dep_p") + + +(define_bypass 5 "z10_larl_fwd_A3, z10_load_fwd_A3, z10_other_fwd_A3, \ + z10_other_fr_A3, z10_int_fwd_A3, z10_int_fr_A3" + "z10_agen, z10_la, z10_branch, z10_call, z10_load, \ + z10_store, \ + z10_cs, z10_stm, z10_other" + "s390_agen_dep_p") + +(define_bypass 6 "z10_other_fr_E1, z10_other_super_c_E1, z10_other_super_E1, \ + z10_other_fwd_E1, \ + z10_lr_fr_E1, z10_larl_super_E1, \ + z10_int_super_E1, z10_int_fwd_E1, z10_int_fr_E1" + "z10_agen, z10_la, z10_branch, z10_call, z10_load, \ + z10_store, \ + z10_cs, z10_stm, z10_other" + "s390_agen_dep_p") + + + +; +; Try to avoid transitions between DFU-, BFU- and FXU-executed instructions as there is a +; dispatch delay required. +; + + +; Declaration for some pseudo-pipeline stages that reflect the +; dispatch gap when issueing an INT/FXU/BFU-executed instruction after +; an instruction executed by a different unit has been executed. The +; approach is that we pretend a pipelined execution of BFU operations +; with as many stages as the gap is long and request that none of +; these stages is busy when issueing a FXU- or DFU-executed +; instruction. Similar for FXU- and DFU-executed instructions. + +; Declaration for FPU stages. +(define_cpu_unit "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, \ + z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, z10_f12" "z10_cpu") +(define_reservation "z10_FP_PP" "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, \ + z10_f5, z10_f6, z10_f7, z10_f8, z10_f9, z10_f10, z10_f11, \ + z10_f12") + +; Declaration for FXU stages. +(define_cpu_unit "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6" "z10_cpu") +(define_cpu_unit "z10_T1, z10_T2, z10_T3, z10_T4, z10_T5, z10_T6" "z10_cpu") +(define_reservation "z10_INT_PP" "z10_S1 | z10_T1, z10_S2 | z10_T2, z10_S3 \ + | z10_T3, z10_S4 | z10_T4, z10_S5 | \ + z10_T5, z10_S6 | z10_T6") + +; Declaration for DFU stages. +(define_cpu_unit "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6" + "z10_cpu") +(define_reservation "z10_DFU_PP" "z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, \ + z10_d5, z10_d6") + + +; Pseudo-units representing whether the respective unit is available +; in the sense that using it does not cause a dispatch delay. + +(define_cpu_unit "z10_S_avail, z10_T_avail, z10_FP_avail, z10_DFU_avail" + "z10_cpu") + +(absence_set "z10_FP_avail" + "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \ + z10_T5, z10_T6, \ + z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6") + +(absence_set "z10_S_avail,z10_T_avail" + "z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \ + z10_f8, z10_f9, z10_f10, z10_f11, z10_f12, \ + z10_d0, z10_d1, z10_d2, z10_d3, z10_d4, z10_d5, z10_d6") + +(absence_set "z10_DFU_avail" + "z10_S1, z10_S2, z10_S3, z10_S4, z10_S5, z10_S6, z10_T1, z10_T2, z10_T3, z10_T4, \ + z10_T5, z10_T6, \ + z10_f0, z10_f1, z10_f2, z10_f3, z10_f4, z10_f5, z10_f6, z10_f7, \ + z10_f8, z10_f9, z10_f10, z10_f11, z10_f12") + + +; Pseudo-units to be used in insn_reservations. + +(define_reservation "z10_Gate_ANY" "((z10_S_avail | z10_T_avail), z10_INT_PP)") +(define_reservation "z10_Gate_BOTH" "((z10_S_avail + z10_T_avail), z10_INT_PP)") + +(define_reservation "z10_Gate_FP" "z10_FP_avail, z10_FP_PP") + +(define_reservation "z10_Gate_DFU" "z10_DFU_avail, z10_DFU_PP") diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 9d60c442542..957707b8607 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -192,33 +192,33 @@ struct processor_costs z9_109_cost = static const struct processor_costs z10_cost = { - COSTS_N_INSNS (4), /* M */ - COSTS_N_INSNS (2), /* MGHI */ - COSTS_N_INSNS (2), /* MH */ - COSTS_N_INSNS (2), /* MHI */ - COSTS_N_INSNS (4), /* ML */ - COSTS_N_INSNS (4), /* MR */ - COSTS_N_INSNS (5), /* MS */ - COSTS_N_INSNS (6), /* MSG */ - COSTS_N_INSNS (4), /* MSGF */ - COSTS_N_INSNS (4), /* MSGFR */ - COSTS_N_INSNS (4), /* MSGR */ - COSTS_N_INSNS (4), /* MSR */ - COSTS_N_INSNS (1), /* multiplication in DFmode */ - COSTS_N_INSNS (28), /* MXBR */ - COSTS_N_INSNS (130), /* SQXBR */ - COSTS_N_INSNS (66), /* SQDBR */ + COSTS_N_INSNS (10), /* M */ + COSTS_N_INSNS (10), /* MGHI */ + COSTS_N_INSNS (10), /* MH */ + COSTS_N_INSNS (10), /* MHI */ + COSTS_N_INSNS (10), /* ML */ + COSTS_N_INSNS (10), /* MR */ + COSTS_N_INSNS (10), /* MS */ + COSTS_N_INSNS (10), /* MSG */ + COSTS_N_INSNS (10), /* MSGF */ + COSTS_N_INSNS (10), /* MSGFR */ + COSTS_N_INSNS (10), /* MSGR */ + COSTS_N_INSNS (10), /* MSR */ + COSTS_N_INSNS (10), /* multiplication in DFmode */ + COSTS_N_INSNS (50), /* MXBR */ + COSTS_N_INSNS (120), /* SQXBR */ + COSTS_N_INSNS (52), /* SQDBR */ COSTS_N_INSNS (38), /* SQEBR */ - COSTS_N_INSNS (1), /* MADBR */ - COSTS_N_INSNS (1), /* MAEBR */ - COSTS_N_INSNS (60), /* DXBR */ - COSTS_N_INSNS (40), /* DDBR */ - COSTS_N_INSNS (26), /* DEBR */ - COSTS_N_INSNS (30), /* DLGR */ - COSTS_N_INSNS (23), /* DLR */ - COSTS_N_INSNS (23), /* DR */ - COSTS_N_INSNS (24), /* DSGFR */ - COSTS_N_INSNS (24), /* DSGR */ + COSTS_N_INSNS (10), /* MADBR */ + COSTS_N_INSNS (10), /* MAEBR */ + COSTS_N_INSNS (111), /* DXBR */ + COSTS_N_INSNS (39), /* DDBR */ + COSTS_N_INSNS (32), /* DEBR */ + COSTS_N_INSNS (160), /* DLGR */ + COSTS_N_INSNS (71), /* DLR */ + COSTS_N_INSNS (71), /* DR */ + COSTS_N_INSNS (71), /* DSGFR */ + COSTS_N_INSNS (71), /* DSGR */ }; extern int reload_completed; @@ -5266,6 +5266,7 @@ s390_agen_dep_p (rtx dep_insn, rtx insn) return 0; } + /* A C statement (sans semicolon) to update the integer scheduling priority INSN_PRIORITY (INSN). Increase the priority to execute the INSN earlier, reduce the priority to execute INSN later. Do not define this macro if diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index f9e89c9fe07..21cde2bc278 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -202,8 +202,12 @@ branch,jsr,fsimptf,fsimpdf,fsimpsf, floadtf,floaddf,floadsf,fstoredf,fstoresf, fmultf,fmuldf,fmulsf,fdivtf,fdivdf,fdivsf, - ftoi,itof,fsqrttf,fsqrtdf,fsqrtsf, - ftrunctf,ftruncdf,other" + ftoi,fsqrttf,fsqrtdf,fsqrtsf, + ftrunctf,ftruncdf, ftruncsd, ftruncdd, + itoftf, itofdf, itofsf, itofdd, itoftd, + fdivdd, fdivtd, floaddd, floadsd, fmuldd, fmultd, + fsimpdd, fsimpsd, fsimptd, fstoredd, fstoresd, + ftoidfp, other" (cond [(eq_attr "op_type" "NN") (const_string "other") (eq_attr "op_type" "SS") (const_string "cs")] (const_string "integer"))) @@ -217,6 +221,31 @@ (const_string "reg") (const_string "agen"))) +;; Properties concerning Z10 execution grouping and value forwarding. +;; z10_super: instruction is superscalar. +;; z10_super_c: instruction is superscalar and meets the condition of z10_c. +;; z10_fwd: The instruction reads the value of an operand and stores it into a +;; target register. It can forward this value to a second instruction that reads +;; the same register if that second instruction is issued in the same group. +;; z10_rec: The instruction is in the T pipeline and reads a register. If the +;; instruction in the S pipe writes to the register, then the T instruction +;; can immediately read the new value. +;; z10_fr: union of Z10_fwd and z10_rec. +;; z10_c: second operand of instruction is a register and read with complemented bits. +;; z10_cobra: its a compare and branch instruction +;; +;; An additional suffix A1, A3, or E1 indicates the respective AGI bypass. + + +(define_attr "z10prop" "none, + z10_super, z10_super_E1, z10_super_A1, z10_super_c, z10_super_c_E1, + z10_fwd, z10_fwd_A1, z10_fwd_A3, z10_fwd_E1, + z10_rec, + z10_fr, z10_fr_A3, z10_fr_E1, + z10_c, z10_cobra" + (const_string "none")) + + ;; Length in bytes. (define_attr "length" "" @@ -272,6 +301,9 @@ ;; Pipeline description for z990, z9-109 and z9-ec. (include "2084.md") +;; Pipeline description for z10 +(include "2097.md") + ;; Predicates (include "predicates.md") @@ -388,12 +420,6 @@ ;; modes and to an empty string for bfp modes. (define_mode_attr _d [(TF "") (DF "") (SF "") (TD "d") (DD "d") (SD "d")]) -;; Although it is imprecise for z9-ec we handle all dfp instructions like -;; bfp regarding the pipeline description. -(define_mode_attr bfp [(TF "tf") (DF "df") (SF "sf") - (TD "tf") (DD "df") (SD "sf")]) - - ;; In GPR and P templates, a constraint like "<d0>" will expand to "d" in DImode ;; and "0" in SImode. This allows to combine instructions of which the 31bit ;; version only operates on one register. @@ -403,13 +429,13 @@ ;; version only operates on one register. The DImode version needs an additional ;; register for the assembler output. (define_mode_attr 1 [(DI "%1,") (SI "")]) - -;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in + +;; In SHIFT templates, a string like "s<lr>dl" will expand to "sldl" in ;; 'ashift' and "srdl" in 'lshiftrt'. (define_code_attr lr [(ashift "l") (lshiftrt "r")]) ;; In SHIFT templates, this attribute holds the correct standard name for the -;; pattern itself and the corresponding function calls. +;; pattern itself and the corresponding function calls. (define_code_attr shift [(ashift "ashl") (lshiftrt "lshr")]) ;; This attribute handles differences in the instruction 'type' and will result @@ -499,7 +525,8 @@ "@ tm\t%S0,%b1 tmy\t%S0,%b1" - [(set_attr "op_type" "SI,SIY")]) + [(set_attr "op_type" "SI,SIY") + (set_attr "z10prop" "z10_super,z10_super")]) (define_insn "*tmdi_reg" [(set (reg CC_REGNUM) @@ -515,7 +542,8 @@ tmhl\t%0,%i1 tmlh\t%0,%i1 tmll\t%0,%i1" - [(set_attr "op_type" "RI")]) + [(set_attr "op_type" "RI") + (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super")]) (define_insn "*tmsi_reg" [(set (reg CC_REGNUM) @@ -558,7 +586,8 @@ "ltgfr\t%2,%0 ltgf\t%2,%0" [(set_attr "op_type" "RRE,RXY") - (set_attr "cpu_facility" "*,z10")]) + (set_attr "cpu_facility" "*,z10") + (set_attr "z10prop" "z10_super_E1,z10_super_E1") ]) ; ltr, lt, ltgr, ltg (define_insn "*tst<mode>_extimm" @@ -571,7 +600,8 @@ "@ lt<g>r\t%2,%0 lt<g>\t%2,%0" - [(set_attr "op_type" "RR<E>,RXY")]) + [(set_attr "op_type" "RR<E>,RXY") + (set_attr "z10prop" "z10_fr_E1,z10_fr_A3") ]) ; ltr, lt, ltgr, ltg (define_insn "*tst<mode>_cconly_extimm" @@ -583,7 +613,8 @@ "@ lt<g>r\t%0,%0 lt<g>\t%2,%0" - [(set_attr "op_type" "RR<E>,RXY")]) + [(set_attr "op_type" "RR<E>,RXY") + (set_attr "z10prop" "z10_fr_E1,z10_fr_A3")]) (define_insn "*tstdi" [(set (reg CC_REGNUM) @@ -593,7 +624,8 @@ (match_dup 0))] "s390_match_ccmode(insn, CCSmode) && TARGET_64BIT && !TARGET_EXTIMM" "ltgr\t%2,%0" - [(set_attr "op_type" "RRE")]) + [(set_attr "op_type" "RRE") + (set_attr "z10prop" "z10_fr_E1")]) (define_insn "*tstsi" [(set (reg CC_REGNUM) @@ -606,7 +638,8 @@ ltr\t%2,%0 icm\t%2,15,%S0 icmy\t%2,15,%S0" - [(set_attr "op_type" "RR,RS,RSY")]) + [(set_attr "op_type" "RR,RS,RSY") + (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")]) (define_insn "*tstsi_cconly" [(set (reg CC_REGNUM) @@ -618,7 +651,8 @@ ltr\t%0,%0 icm\t%2,15,%S0 icmy\t%2,15,%S0" - [(set_attr "op_type" "RR,RS,RSY")]) + [(set_attr "op_type" "RR,RS,RSY") + (set_attr "z10prop" "z10_fr_E1,z10_super_E1,z10_super_E1")]) (define_insn "*tstdi_cconly_31" [(set (reg CC_REGNUM) @@ -636,7 +670,8 @@ (match_operand:GPR 1 "const0_operand" "")))] "s390_match_ccmode(insn, CCSmode)" "lt<g>r\t%0,%0" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_fr_E1")]) ; tst(hi|qi) instruction pattern(s). @@ -651,7 +686,8 @@ icm\t%2,<icm_lo>,%S0 icmy\t%2,<icm_lo>,%S0 tml\t%0,<max_uint>" - [(set_attr "op_type" "RS,RSY,RI")]) + [(set_attr "op_type" "RS,RSY,RI") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")]) (define_insn "*tsthiCCT_cconly" [(set (reg CC_REGNUM) @@ -663,7 +699,8 @@ icm\t%2,3,%S0 icmy\t%2,3,%S0 tml\t%0,65535" - [(set_attr "op_type" "RS,RSY,RI")]) + [(set_attr "op_type" "RS,RSY,RI") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super")]) (define_insn "*tstqiCCT_cconly" [(set (reg CC_REGNUM) @@ -674,7 +711,8 @@ cli\t%S0,0 cliy\t%S0,0 tml\t%0,255" - [(set_attr "op_type" "SI,SIY,RI")]) + [(set_attr "op_type" "SI,SIY,RI") + (set_attr "z10prop" "z10_super,z10_super,*")]) (define_insn "*tst<mode>" [(set (reg CC_REGNUM) @@ -686,7 +724,8 @@ "@ icm\t%2,<icm_lo>,%S0 icmy\t%2,<icm_lo>,%S0" - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*tst<mode>_cconly" [(set (reg CC_REGNUM) @@ -697,7 +736,8 @@ "@ icm\t%2,<icm_lo>,%S0 icmy\t%2,<icm_lo>,%S0" - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) ; Compare (equality) instructions @@ -713,7 +753,8 @@ cgfi\t%0,%1 cg\t%0,%1 #" - [(set_attr "op_type" "RRE,RI,RIL,RXY,SS")]) + [(set_attr "op_type" "RRE,RI,RIL,RXY,SS") + (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,*")]) (define_insn "*cmpsi_cct" [(set (reg CC_REGNUM) @@ -727,8 +768,8 @@ c\t%0,%1 cy\t%0,%1 #" - [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS")]) - + [(set_attr "op_type" "RR,RI,RIL,RX,RXY,SS") + (set_attr "z10prop" "z10_super,z10_super,z10_super,z10_super,z10_super,*")]) ; Compare (signed) instructions @@ -743,9 +784,11 @@ cgf\t%0,%1 cgfrl\t%0,%1" [(set_attr "op_type" "RRE,RXY,RIL") - (set_attr "cpu_facility" "*,*,z10") + (set_attr "z10prop" "z10_c,*,*") (set_attr "type" "*,*,larl")]) + + (define_insn "*cmpsi_ccs_sign" [(set (reg CC_REGNUM) (compare (sign_extend:SI (match_operand:HI 1 "memory_operand" "R,T,b")) @@ -796,7 +839,8 @@ c<g>rl\t%0,%1" [(set_attr "op_type" "RR<E>,RI,SIL,RIL,RX<Y>,RXY,RIL") (set_attr "cpu_facility" "*,*,z10,extimm,*,*,z10") - (set_attr "type" "*,*,*,*,*,*,larl")]) + (set_attr "type" "*,*,*,*,*,*,larl") + (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,z10_super")]) ; Compare (unsigned) instructions @@ -820,7 +864,8 @@ "s390_match_ccmode(insn, CCURmode) && TARGET_Z10" "cl<g>hrl\t%0,%1" [(set_attr "op_type" "RIL") - (set_attr "type" "larl")]) + (set_attr "type" "larl") + (set_attr "z10prop" "z10_super")]) (define_insn "*cmpdi_ccu_zero" [(set (reg CC_REGNUM) @@ -834,7 +879,8 @@ clgfrl\t%0,%1" [(set_attr "op_type" "RRE,RXY,RIL") (set_attr "cpu_facility" "*,*,z10") - (set_attr "type" "*,*,larl")]) + (set_attr "type" "*,*,larl") + (set_attr "z10prop" "z10_super_c,z10_super_E1,z10_super")]) (define_insn "*cmpdi_ccu" [(set (reg CC_REGNUM) @@ -853,7 +899,8 @@ #" [(set_attr "op_type" "RRE,RIL,RIL,SIL,RXY,SS,SS") (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*") - (set_attr "type" "*,*,larl,*,*,*,*")]) + (set_attr "type" "*,*,larl,*,*,*,*") + (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,*,*")]) (define_insn "*cmpsi_ccu" [(set (reg CC_REGNUM) @@ -871,7 +918,8 @@ #" [(set_attr "op_type" "RR,RIL,RIL,SIL,RX,RXY,SS,SS") (set_attr "cpu_facility" "*,extimm,z10,z10,*,*,*,*") - (set_attr "type" "*,*,larl,*,*,*,*,*")]) + (set_attr "type" "*,*,larl,*,*,*,*,*") + (set_attr "z10prop" "z10_super_c,z10_super,z10_super,z10_super,z10_super,z10_super,*,*")]) (define_insn "*cmphi_ccu" [(set (reg CC_REGNUM) @@ -886,7 +934,8 @@ # #" [(set_attr "op_type" "RS,RSY,SIL,SS,SS") - (set_attr "cpu_facility" "*,*,z10,*,*")]) + (set_attr "cpu_facility" "*,*,z10,*,*") + (set_attr "z10prop" "*,*,z10_super,*,*")]) (define_insn "*cmpqi_ccu" [(set (reg CC_REGNUM) @@ -901,7 +950,8 @@ cliy\t%S0,%b1 # #" - [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS")]) + [(set_attr "op_type" "RS,RSY,SI,SIY,SS,SS") + (set_attr "z10prop" "*,*,z10_super,z10_super,*,*")]) ; Block compare (CLC) instruction patterns. @@ -948,7 +998,7 @@ "s390_match_ccmode(insn, CCSmode) && TARGET_HARD_FLOAT" "lt<xde><bt>r\t%0,%0" [(set_attr "op_type" "RRE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; cxtr, cxbr, cdbr, cebr, cxb, cdb, ceb, cxbtr, cdbtr (define_insn "*cmp<mode>_ccs" @@ -960,12 +1010,14 @@ c<xde><bt>r\t%0,%1 c<xde>b\t%0,%1" [(set_attr "op_type" "RRE,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; Compare and Branch instructions ; cij, cgij, crj, cgrj, cfi, cgfi, cr, cgr +; The following instructions do a complementary access of their second +; operand (z01 only): crj_c, cgrjc, cr, cgr (define_insn "*cmp_and_br_signed_<mode>" [(set (pc) (if_then_else (match_operator 0 "s390_signed_integer_comparison" @@ -985,12 +1037,15 @@ } [(set_attr "op_type" "RIE") (set_attr "type" "branch") + (set_attr "z10prop" "z10_cobra,z10_super") (set (attr "length") (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) (const_int 6) (const_int 12)))]) ; 8 byte for cr/jg ; 10 byte for cgr/jg ; clij, clgij, clrj, clgrj, clfi, clgfi, clr, clgr +; The following instructions do a complementary access of their second +; operand (z10 only): clrj, clgrj, clr, clgr (define_insn "*cmp_and_br_unsigned_<mode>" [(set (pc) (if_then_else (match_operator 0 "s390_unsigned_integer_comparison" @@ -1010,6 +1065,7 @@ } [(set_attr "op_type" "RIE") (set_attr "type" "branch") + (set_attr "z10prop" "z10_cobra,z10_super") (set (attr "length") (if_then_else (lt (abs (minus (pc) (match_dup 3))) (const_int 60000)) (const_int 6) (const_int 12)))]) ; 8 byte for clr/jg @@ -1210,7 +1266,8 @@ && !FP_REG_P (operands[0])" "larl\t%0,%1" [(set_attr "op_type" "RIL") - (set_attr "type" "larl")]) + (set_attr "type" "larl") + (set_attr "z10prop" "z10_super_A1")]) (define_insn "*movdi_64" [(set (match_operand:DI 0 "nonimmediate_operand" @@ -1255,7 +1312,35 @@ *,*,*") (set_attr "cpu_facility" "*,*,*,*,*,extimm,extimm,extimm,dfp,dfp,longdisp, z10,*,*,*,*,*,longdisp,*,longdisp, - z10,z10,*,*,*,*,*")]) + z10,z10,*,*,*,*,*") + (set_attr "z10prop" "z10_fwd_A1, + z10_fwd_E1, + z10_fwd_E1, + z10_fwd_E1, + z10_fwd_E1, + z10_fwd_A1, + z10_fwd_E1, + z10_fwd_E1, + *, + *, + z10_fwd_A1, + z10_fwd_A3, + z10_fr_E1, + z10_fwd_A3, + z10_rec, + *, + *, + *, + *, + *, + z10_rec, + z10_super, + *, + *, + *, + *, + *") +]) (define_split [(set (match_operand:DI 0 "register_operand" "") @@ -1390,7 +1475,8 @@ la\t%0,%a1 lay\t%0,%a1" [(set_attr "op_type" "RX,RXY") - (set_attr "type" "la")]) + (set_attr "type" "la") + (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) (define_peephole2 [(parallel @@ -1441,7 +1527,8 @@ && !FP_REG_P (operands[0])" "larl\t%0,%1" [(set_attr "op_type" "RIL") - (set_attr "type" "larl")]) + (set_attr "type" "larl") + (set_attr "z10prop" "z10_super_A1")]) (define_insn "*movsi_zarch" [(set (match_operand:SI 0 "nonimmediate_operand" @@ -1475,10 +1562,54 @@ #" [(set_attr "op_type" "RI,RI,RI,RIL,RXY,RIL,RR,RX,RXY,RX,RXY, RR,RX,RXY,RX,RXY,RRE,RRE,RS,RIL,SIL,RS,SS") - (set_attr "type" "*,*,*,*,la,larl,lr,load,load,store,store, - floadsf,floadsf,floadsf,fstoresf,fstoresf,*,*,*,larl,*,*,*") + (set_attr "type" "*, + *, + *, + *, + la, + larl, + lr, + load, + load, + store, + store, + floadsf, + floadsf, + floadsf, + fstoresf, + fstoresf, + *, + *, + *, + larl, + *, + *, + *") (set_attr "cpu_facility" "*,*,*,extimm,longdisp,z10,*,*,longdisp,*,longdisp, - *,*,longdisp,*,longdisp,*,*,*,z10,z10,*,*")]) + *,*,longdisp,*,longdisp,*,*,*,z10,z10,*,*") + (set_attr "z10prop" "z10_fwd_A1, + z10_fwd_E1, + z10_fwd_E1, + z10_fwd_A1, + z10_fwd_A1, + z10_fwd_A3, + z10_fr_E1, + z10_fwd_A3, + z10_fwd_A3, + z10_super, + z10_rec, + *, + *, + *, + *, + *, + z10_super_E1, + z10_super, + *, + z10_rec, + z10_super, + *, + *")]) (define_insn "*movsi_esa" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,R,!*f,!*f,!R,d,t,Q,t,?Q") @@ -1498,7 +1629,20 @@ lam\t%0,%0,%S1 #" [(set_attr "op_type" "RI,RR,RX,RX,RR,RX,RX,RRE,RRE,RS,RS,SS") - (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*")]) + (set_attr "type" "*,lr,load,store,floadsf,floadsf,fstoresf,*,*,*,*,*") + (set_attr "z10prop" "z10_fwd_A1, + z10_fr_E1, + z10_fwd_A3, + z10_super, + *, + *, + *, + z10_super_E1, + z10_super, + *, + *, + *") +]) (define_peephole2 [(set (match_operand:SI 0 "register_operand" "") @@ -1519,7 +1663,8 @@ la\t%0,%a1 lay\t%0,%a1" [(set_attr "op_type" "RX,RXY") - (set_attr "type" "la")]) + (set_attr "type" "la") + (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) (define_peephole2 [(parallel @@ -1554,7 +1699,8 @@ la\t%0,%a1 lay\t%0,%a1" [(set_attr "op_type" "RX,RXY") - (set_attr "type" "la")]) + (set_attr "type" "la") + (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) (define_insn_and_split "*la_31_and_cc" [(set (match_operand:SI 0 "register_operand" "=d") @@ -1579,7 +1725,8 @@ la\t%0,%a1 lay\t%0,%a1" [(set_attr "op_type" "RX") - (set_attr "type" "la")]) + (set_attr "type" "la") + (set_attr "z10prop" "z10_fwd_A1,z10_fwd_A1")]) ; ; movhi instruction pattern(s). @@ -1620,7 +1767,17 @@ #" [(set_attr "op_type" "RR,RI,RX,RXY,RIL,RX,RXY,RIL,SIL,SS") (set_attr "type" "lr,*,*,*,larl,store,store,store,*,*") - (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,*")]) + (set_attr "cpu_facility" "*,*,*,*,z10,*,*,z10,z10,*") + (set_attr "z10prop" "z10_fr_E1, + z10_fwd_A1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super, + z10_rec, + z10_rec, + z10_super, + *")]) (define_peephole2 [(set (match_operand:HI 0 "register_operand" "") @@ -1669,7 +1826,16 @@ mviy\t%S0,%b1 #" [(set_attr "op_type" "RR,RI,RX,RXY,RX,RXY,SI,SIY,SS") - (set_attr "type" "lr,*,*,*,store,store,store,store,*")]) + (set_attr "type" "lr,*,*,*,store,store,store,store,*") + (set_attr "z10prop" "z10_fr_E1, + z10_fwd_A1, + z10_super_E1, + z10_super_E1, + z10_super, + z10_rec, + z10_super, + z10_super, + *")]) (define_peephole2 [(set (match_operand:QI 0 "nonimmediate_operand" "") @@ -1692,7 +1858,8 @@ "@ ic\t%0,%1 icy\t%0,%1" - [(set_attr "op_type" "RX,RXY")]) + [(set_attr "op_type" "RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super")]) ; ; movstricthi instruction pattern(s). @@ -1706,7 +1873,8 @@ "@ icm\t%0,3,%S1 icmy\t%0,3,%S1" - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) ; ; movstrictsi instruction pattern(s). @@ -1722,7 +1890,8 @@ ly\t%0,%1 ear\t%0,%1" [(set_attr "op_type" "RR,RX,RXY,RRE") - (set_attr "type" "lr,load,load,*")]) + (set_attr "type" "lr,load,load,*") + (set_attr "z10prop" "z10_fr_E1,z10_fwd_A3,z10_fwd_A3,z10_super_E1")]) ; ; mov(tf|td) instruction pattern(s). @@ -1812,7 +1981,7 @@ (define_split [(set (match_operand:TD_TF 0 "register_operand" "") (match_operand:TD_TF 1 "memory_operand" ""))] - "reload_completed && offsettable_memref_p (operands[1]) + "reload_completed && offsettable_memref_p (operands[1]) && FP_REG_P (operands[0])" [(set (match_dup 2) (match_dup 4)) (set (match_dup 3) (match_dup 5))] @@ -1872,7 +2041,20 @@ #" [(set_attr "op_type" "RRE,RR,RRE,RRE,RX,RXY,RX,RXY,RRE,RXY,RXY,SS") (set_attr "type" "fsimpdf,floaddf,floaddf,floaddf,floaddf,floaddf, - fstoredf,fstoredf,lr,load,store,*")]) + fstoredf,fstoredf,lr,load,store,*") + (set_attr "z10prop" "*, + *, + *, + *, + *, + *, + *, + *, + z10_fr_E1, + z10_fwd_A3, + z10_rec, + *") +]) (define_insn "*mov<mode>_64" [(set (match_operand:DD_DF 0 "nonimmediate_operand" "=f,f,f,f,R,T,d, d,RT,?Q") @@ -1890,8 +2072,18 @@ stg\t%1,%0 #" [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RRE,RXY,RXY,SS") - (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>, - fstore<bfp>,fstore<bfp>,lr,load,store,*")]) + (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>, + fstore<mode>,fstore<mode>,lr,load,store,*") + (set_attr "z10prop" "*, + *, + *, + *, + *, + *, + z10_fr_E1, + z10_fwd_A3, + z10_rec, + *")]) (define_insn "*mov<mode>_31" [(set (match_operand:DD_DF 0 "nonimmediate_operand" @@ -1914,8 +2106,8 @@ # #" [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RS,RSY,RS,RSY,*,*,SS") - (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>, - fstore<bfp>,fstore<bfp>,lm,lm,stm,stm,*,*,*")]) + (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>, + fstore<mode>,fstore<mode>,lm,lm,stm,stm,*,*,*")]) (define_split [(set (match_operand:DD_DF 0 "nonimmediate_operand" "") @@ -1982,8 +2174,20 @@ sty\t%1,%0 #" [(set_attr "op_type" "RRE,RR,RX,RXY,RX,RXY,RR,RX,RXY,RX,RXY,SS") - (set_attr "type" "fsimp<bfp>,fload<bfp>,fload<bfp>,fload<bfp>, - fstore<bfp>,fstore<bfp>,lr,load,load,store,store,*")]) + (set_attr "type" "fsimp<mode>,fload<mode>,fload<mode>,fload<mode>, + fstore<mode>,fstore<mode>,lr,load,load,store,store,*") + (set_attr "z10prop" "*, + *, + *, + *, + *, + *, + z10_fr_E1, + z10_fwd_A3, + z10_fwd_A3, + z10_super, + z10_rec, + *")]) ; ; movcc instruction pattern @@ -2002,7 +2206,8 @@ l\t%1,%0 ly\t%1,%0" [(set_attr "op_type" "RR,RI,RRE,RX,RXY,RX,RXY") - (set_attr "type" "lr,*,*,store,store,load,load")]) + (set_attr "type" "lr,*,*,store,store,load,load") + (set_attr "z10prop" "z10_fr_E1,*,*,z10_super,z10_rec,z10_fwd_A3,z10_fwd_A3")]) ; ; Block move (MVC) patterns. @@ -2042,7 +2247,7 @@ (use (match_operand 5 "const_int_operand" ""))])] "s390_offset_p (operands[0], operands[3], operands[2]) && s390_offset_p (operands[1], operands[4], operands[2]) - && !s390_overlap_p (operands[0], operands[1], + && !s390_overlap_p (operands[0], operands[1], INTVAL (operands[2]) + INTVAL (operands[5])) && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" [(parallel @@ -2348,19 +2553,19 @@ "clst\t%0,%1\;jo\t.-4" [(set_attr "length" "8") (set_attr "type" "vs")]) - + ; ; movstr instruction pattern. ; (define_expand "movstr" [(set (reg:SI 0) (const_int 0)) - (parallel + (parallel [(clobber (match_dup 3)) (set (match_operand:BLK 1 "memory_operand" "") (match_operand:BLK 2 "memory_operand" "")) (set (match_operand 0 "register_operand" "") - (unspec [(match_dup 1) + (unspec [(match_dup 1) (match_dup 2) (reg:SI 0)] UNSPEC_MVST)) (clobber (reg:CC CC_REGNUM))])] @@ -2381,7 +2586,7 @@ (set (mem:BLK (match_operand:P 1 "register_operand" "0")) (mem:BLK (match_operand:P 3 "register_operand" "2"))) (set (match_operand:P 0 "register_operand" "=d") - (unspec [(mem:BLK (match_dup 1)) + (unspec [(mem:BLK (match_dup 1)) (mem:BLK (match_dup 3)) (reg:SI 0)] UNSPEC_MVST)) (clobber (reg:CC CC_REGNUM))] @@ -2389,7 +2594,7 @@ "mvst\t%1,%2\;jo\t.-4" [(set_attr "length" "8") (set_attr "type" "vs")]) - + ; ; movmemM instruction pattern(s). @@ -2477,7 +2682,7 @@ "reload_completed && TARGET_CPU_ZARCH" [(set (match_dup 3) (label_ref (match_dup 4))) (parallel - [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) + [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) (label_ref (match_dup 4))] UNSPEC_EXECUTE) (set (match_dup 0) (match_dup 1)) (use (const_int 1))])] @@ -2538,8 +2743,8 @@ (define_expand "signbit<mode>2" [(set (reg:CCZ CC_REGNUM) - (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") - (match_dup 2)] + (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") + (match_dup 2)] UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))] @@ -2550,8 +2755,8 @@ (define_expand "isinf<mode>2" [(set (reg:CCZ CC_REGNUM) - (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") - (match_dup 2)] + (unspec:CCZ [(match_operand:FP_ALL 1 "register_operand" "f") + (match_dup 2)] UNSPEC_TDC_INSN)) (set (match_operand:SI 0 "register_operand" "=d") (unspec:SI [(reg:CCZ CC_REGNUM)] UNSPEC_CCZ_TO_INT))] @@ -2563,16 +2768,16 @@ ; This insn is used to generate all variants of the Test Data Class ; instruction, namely tcxb, tcdb, and tceb. The insn's first operand ; is the register to be tested and the second one is the bit mask -; specifying the required test(s). +; specifying the required test(s). ; (define_insn "*TDC_insn_<mode>" [(set (reg:CCZ CC_REGNUM) - (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f") + (unspec:CCZ [(match_operand:FP_ALL 0 "register_operand" "f") (match_operand:SI 1 "const_int_operand")] UNSPEC_TDC_INSN))] "TARGET_HARD_FLOAT" "t<_d>c<xde><bt>\t%0,%1" [(set_attr "op_type" "RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) (define_insn_and_split "*ccz_to_int" [(set (match_operand:SI 0 "register_operand" "=d") @@ -2679,14 +2884,14 @@ "reload_completed && TARGET_CPU_ZARCH" [(set (match_dup 2) (label_ref (match_dup 3))) (parallel - [(unspec [(match_dup 1) (mem:BLK (match_dup 2)) + [(unspec [(match_dup 1) (mem:BLK (match_dup 2)) (label_ref (match_dup 3))] UNSPEC_EXECUTE) (set (match_dup 0) (const_int 0)) (use (const_int 1)) (clobber (reg:CC CC_REGNUM))])] "operands[3] = gen_label_rtx ();") -; Initialize a block of arbitrary length with (operands[2] % 256). +; Initialize a block of arbitrary length with (operands[2] % 256). (define_expand "setmem_long" [(parallel @@ -2833,7 +3038,7 @@ "reload_completed && TARGET_CPU_ZARCH" [(set (match_dup 3) (label_ref (match_dup 4))) (parallel - [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) + [(unspec [(match_dup 2) (mem:BLK (match_dup 3)) (label_ref (match_dup 4))] UNSPEC_EXECUTE) (set (reg:CCU CC_REGNUM) (compare:CCU (match_dup 0) (match_dup 1))) (use (const_int 1))])] @@ -2938,7 +3143,7 @@ (define_insn_and_split "*cmpint_sign_cc" [(set (reg CC_REGNUM) - (compare (ashiftrt:DI (ashift:DI (subreg:DI + (compare (ashiftrt:DI (ashift:DI (subreg:DI (unspec:SI [(match_operand:CCU 1 "register_operand" "0")] UNSPEC_CCU_TO_INT) 0) (const_int 32)) (const_int 32)) @@ -2972,7 +3177,8 @@ "@ icm\t%0,%2,%S1 icmy\t%0,%2,%S1" - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*sethighpartdi_64" [(set (match_operand:DI 0 "register_operand" "=d") @@ -2992,7 +3198,9 @@ "@ icm\t%0,%2,%S1 icmy\t%0,%2,%S1" - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) + (define_insn_and_split "*extzv<mode>" [(set (match_operand:GPR 0 "register_operand" "=d") @@ -3083,7 +3291,8 @@ return "risbg\t%0,%3,%b2,%b1,%b4"; } - [(set_attr "op_type" "RIE")]) + [(set_attr "op_type" "RIE") + (set_attr "z10prop" "z10_super_E1")]) ; and op1 with a mask being 1 for the selected bits and 0 for the rest ; and op3=op0 with a mask being 0 for the selected bits and 1 for the rest @@ -3112,7 +3321,8 @@ return "risbg\t%0,%1,%b5,%b6,%b7"; } - [(set_attr "op_type" "RIE")]) + [(set_attr "op_type" "RIE") + (set_attr "z10prop" "z10_super_E1")]) ; and op1 with a mask being 1 for the selected bits and 0 for the rest (define_insn "*insv<mode>_or_z10_noshift" @@ -3151,10 +3361,11 @@ int size = INTVAL (operands[1]) / BITS_PER_UNIT; operands[1] = GEN_INT ((1ul << size) - 1); - return (which_alternative == 0) ? "stcm\t%2,%1,%S0" + return (which_alternative == 0) ? "stcm\t%2,%1,%S0" : "stcmy\t%2,%1,%S0"; } - [(set_attr "op_type" "RS,RSY")]) + [(set_attr "op_type" "RS,RSY") + (set_attr "z10prop" "z10_super,z10_super")]) (define_insn "*insvdi_mem_reghigh" [(set (zero_extract:DI (match_operand:QI 0 "memory_operand" "+QS") @@ -3172,7 +3383,8 @@ operands[1] = GEN_INT ((1ul << size) - 1); return "stcmh\t%2,%1,%S0"; } -[(set_attr "op_type" "RSY")]) +[(set_attr "op_type" "RSY") + (set_attr "z10prop" "z10_super")]) (define_insn "*insv<mode>_reg_imm" [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d") @@ -3193,7 +3405,9 @@ default: gcc_unreachable(); } } - [(set_attr "op_type" "RI")]) + [(set_attr "op_type" "RI") + (set_attr "z10prop" "z10_super_E1")]) + (define_insn "*insv<mode>_reg_extimm" [(set (zero_extract:P (match_operand:P 0 "register_operand" "+d") @@ -3212,7 +3426,9 @@ default: gcc_unreachable(); } } - [(set_attr "op_type" "RIL")]) + [(set_attr "op_type" "RIL") + (set_attr "z10prop" "z10_fwd_E1")]) + ; ; extendsidi2 instruction pattern(s). @@ -3243,7 +3459,8 @@ lgfrl\t%0,%1" [(set_attr "op_type" "RRE,RXY,RIL") (set_attr "type" "*,*,larl") - (set_attr "cpu_facility" "*,*,z10")]) + (set_attr "cpu_facility" "*,*,z10") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; ; extend(hi|qi)(si|di)2 instruction pattern(s). @@ -3287,14 +3504,16 @@ lghrl\t%0,%1" [(set_attr "op_type" "RRE,RXY,RIL") (set_attr "type" "*,*,larl") - (set_attr "cpu_facility" "extimm,extimm,z10")]) + (set_attr "cpu_facility" "extimm,extimm,z10") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*extendhidi2" [(set (match_operand:DI 0 "register_operand" "=d") (sign_extend:DI (match_operand:HI 1 "memory_operand" "RT")))] "TARGET_64BIT" "lgh\t%0,%1" - [(set_attr "op_type" "RXY")]) + [(set_attr "op_type" "RXY") + (set_attr "z10prop" "z10_super_E1")]) ; ; extendhisi2 instruction pattern(s). @@ -3311,7 +3530,8 @@ lhrl\t%0,%1" [(set_attr "op_type" "RRE,RX,RXY,RIL") (set_attr "type" "*,*,*,larl") - (set_attr "cpu_facility" "extimm,extimm,extimm,z10")]) + (set_attr "cpu_facility" "extimm,extimm,extimm,z10") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*extendhisi2" [(set (match_operand:SI 0 "register_operand" "=d,d") @@ -3320,7 +3540,8 @@ "@ lh\t%0,%1 lhy\t%0,%1" - [(set_attr "op_type" "RX,RXY")]) + [(set_attr "op_type" "RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) ; ; extendqi(si|di)2 instruction pattern(s). @@ -3334,7 +3555,8 @@ "@ l<g>br\t%0,%1 l<g>b\t%0,%1" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) ; lb, lgb (define_insn "*extendqi<mode>2" @@ -3342,7 +3564,8 @@ (sign_extend:GPR (match_operand:QI 1 "memory_operand" "RT")))] "!TARGET_EXTIMM && TARGET_LONG_DISPLACEMENT" "l<g>b\t%0,%1" - [(set_attr "op_type" "RXY")]) + [(set_attr "op_type" "RXY") + (set_attr "z10prop" "z10_super_E1")]) (define_insn_and_split "*extendqi<mode>2_short_displ" [(set (match_operand:GPR 0 "register_operand" "=d") @@ -3392,7 +3615,8 @@ llgfrl\t%0,%1" [(set_attr "op_type" "RRE,RXY,RIL") (set_attr "type" "*,*,larl") - (set_attr "cpu_facility" "*,*,z10")]) + (set_attr "cpu_facility" "*,*,z10") + (set_attr "z10prop" "z10_fwd_E1,z10_fwd_A3,z10_fwd_A3")]) ; ; LLGT-type instructions (zero-extend from 31 bit to 64 bit). @@ -3404,7 +3628,8 @@ (const_int 2147483647)))] "TARGET_64BIT" "llgt\t%0,%1" - [(set_attr "op_type" "RXE")]) + [(set_attr "op_type" "RXE") + (set_attr "z10prop" "z10_super_E1")]) (define_insn_and_split "*llgt_sidi_split" [(set (match_operand:DI 0 "register_operand" "=d") @@ -3427,7 +3652,8 @@ "@ llgtr\t%0,%1 llgt\t%0,%1" - [(set_attr "op_type" "RRE,RXE")]) + [(set_attr "op_type" "RRE,RXE") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*llgt_didi" [(set (match_operand:DI 0 "register_operand" "=d,d") @@ -3437,7 +3663,8 @@ "@ llgtr\t%0,%1 llgt\t%0,%N1" - [(set_attr "op_type" "RRE,RXE")]) + [(set_attr "op_type" "RRE,RXE") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_split [(set (match_operand:GPR 0 "register_operand" "") @@ -3468,7 +3695,7 @@ } else if (!TARGET_EXTIMM) { - rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) - + rtx bitcount = GEN_INT (GET_MODE_BITSIZE(DImode) - GET_MODE_BITSIZE(<MODE>mode)); operands[1] = gen_lowpart (DImode, operands[1]); emit_insn (gen_ashldi3 (operands[0], operands[1], bitcount)); @@ -3485,7 +3712,7 @@ if (!TARGET_EXTIMM) { operands[1] = gen_lowpart (SImode, operands[1]); - emit_insn (gen_andsi3 (operands[0], operands[1], + emit_insn (gen_andsi3 (operands[0], operands[1], GEN_INT ((1 << GET_MODE_BITSIZE(<MODE>mode)) - 1))); DONE; } @@ -3502,7 +3729,8 @@ ll<g>hrl\t%0,%1" [(set_attr "op_type" "RXY,RRE,RIL") (set_attr "type" "*,*,larl") - (set_attr "cpu_facility" "*,*,z10")]) + (set_attr "cpu_facility" "*,*,z10") + (set_attr "z10prop" "z10_fwd_A3")]) ; llhr, llcr, llghr, llgcr, llh, llc, llgh, llgc (define_insn "*zero_extend<HQI:mode><GPR:mode>2_extimm" @@ -3512,7 +3740,8 @@ "@ ll<g><hc>r\t%0,%1 ll<g><hc>\t%0,%1" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_fwd_A3")]) ; llgh, llgc (define_insn "*zero_extend<HQI:mode><GPR:mode>2" @@ -3520,7 +3749,8 @@ (zero_extend:GPR (match_operand:HQI 1 "memory_operand" "RT")))] "TARGET_ZARCH && !TARGET_EXTIMM" "llg<hc>\t%0,%1" - [(set_attr "op_type" "RXY")]) + [(set_attr "op_type" "RXY") + (set_attr "z10prop" "z10_fwd_A3")]) (define_insn_and_split "*zero_extendhisi2_31" [(set (match_operand:SI 0 "register_operand" "=&d") @@ -3564,7 +3794,8 @@ (zero_extend:HI (match_operand:QI 1 "memory_operand" "RT")))] "TARGET_ZARCH && !TARGET_EXTIMM" "llgc\t%0,%1" - [(set_attr "op_type" "RXY")]) + [(set_attr "op_type" "RXY") + (set_attr "z10prop" "z10_fwd_A3")]) (define_insn_and_split "*zero_extendqihi2_31" [(set (match_operand:HI 0 "register_operand" "=&d") @@ -3585,7 +3816,7 @@ [(set (match_operand:DI 0 "register_operand" "") (unsigned_fix:DI (match_operand:DD 1 "register_operand" ""))) (clobber (match_scratch:TD 2 "=f"))])] - + "TARGET_HARD_FLOAT && TARGET_HARD_DFP" { rtx label1 = gen_label_rtx (); @@ -3597,7 +3828,7 @@ decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */ /* 2^63 can't be represented as 64bit DFP number with full precision. The - solution is doing the check and the subtraction in TD mode and using a + solution is doing the check and the subtraction in TD mode and using a TD -> DI convert afterwards. */ emit_insn (gen_extendddtd2 (temp, operands[1])); temp = force_reg (TDmode, temp); @@ -3624,11 +3855,11 @@ rtx label2 = gen_label_rtx (); rtx temp = gen_reg_rtx (TDmode); REAL_VALUE_TYPE cmp, sub; - + operands[1] = force_reg (TDmode, operands[1]); decimal_real_from_string (&cmp, "9223372036854775808.0"); /* 2^63 */ decimal_real_from_string (&sub, "18446744073709551616.0"); /* 2^64 */ - + emit_insn (gen_cmptd (operands[1], CONST_DOUBLE_FROM_REAL_VALUE (cmp, TDmode))); emit_jump_insn (gen_blt (label1)); @@ -3644,7 +3875,7 @@ }) ; -; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2 +; fixuns_trunc(sf|df)(si|di)2 and fix_trunc(sf|df)(si|di)2 ; instruction pattern(s). ; @@ -3657,11 +3888,11 @@ rtx label2 = gen_label_rtx (); rtx temp = gen_reg_rtx (<BFP:MODE>mode); REAL_VALUE_TYPE cmp, sub; - + operands[1] = force_reg (<BFP:MODE>mode, operands[1]); real_2expN (&cmp, GET_MODE_BITSIZE(<GPR:MODE>mode) - 1, <BFP:MODE>mode); real_2expN (&sub, GET_MODE_BITSIZE(<GPR:MODE>mode), <BFP:MODE>mode); - + emit_insn (gen_cmp<BFP:mode> (operands[1], CONST_DOUBLE_FROM_REAL_VALUE (cmp, <BFP:MODE>mode))); emit_jump_insn (gen_blt (label1)); @@ -3724,7 +3955,7 @@ "TARGET_64BIT && TARGET_HARD_FLOAT && TARGET_HARD_DFP" "cg<DFP:xde>tr\t%0,%h2,%1" [(set_attr "op_type" "RRF") - (set_attr "type" "ftoi")]) + (set_attr "type" "ftoidfp")]) ; @@ -3751,7 +3982,7 @@ "TARGET_64BIT && TARGET_HARD_FLOAT" "c<xde>g<bt>r\t%0,%1" [(set_attr "op_type" "RRE") - (set_attr "type" "itof" )]) + (set_attr "type" "itof<mode>" )]) ; cxfbr, cdfbr, cefbr (define_insn "floatsi<mode>2" @@ -3760,7 +3991,7 @@ "TARGET_HARD_FLOAT" "c<xde>fbr\t%0,%1" [(set_attr "op_type" "RRE") - (set_attr "type" "itof" )]) + (set_attr "type" "itof<mode>" )]) ; @@ -3787,7 +4018,7 @@ "TARGET_HARD_FLOAT" "l<xde>xbr\t%2,%1\;l<xde>r\t%0,%2" [(set_attr "length" "6") - (set_attr "type" "ftrunctf")]) + (set_attr "type" "ftrunctf")]) ; ; trunctddd2 and truncddsd2 instruction pattern(s). @@ -3800,7 +4031,7 @@ "TARGET_HARD_FLOAT && TARGET_HARD_DFP" "ldxtr\t%2,0,%1,0\;ldr\t%0,%2" [(set_attr "length" "6") - (set_attr "type" "ftrunctf")]) + (set_attr "type" "ftruncdd")]) (define_insn "truncddsd2" [(set (match_operand:SD 0 "register_operand" "=f") @@ -3808,7 +4039,7 @@ "TARGET_HARD_FLOAT && TARGET_HARD_DFP" "ledtr\t%0,0,%1,0" [(set_attr "op_type" "RRF") - (set_attr "type" "fsimptf")]) + (set_attr "type" "ftruncsd")]) ; ; extend(sf|df)(df|tf)2 instruction pattern(s). @@ -4045,7 +4276,8 @@ "@ algfr\t%0,%2 algf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*adddi3_zero_cconly" [(set (reg CC_REGNUM) @@ -4057,7 +4289,8 @@ "@ algfr\t%0,%2 algf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*adddi3_zero" [(set (match_operand:DI 0 "register_operand" "=d,d") @@ -4068,7 +4301,8 @@ "@ algfr\t%0,%2 algf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn_and_split "*adddi3_31z" [(set (match_operand:DI 0 "nonimmediate_operand" "=&d") @@ -4171,7 +4405,14 @@ a<y>\t%0,%2 a<g>si\t%0,%c2" [(set_attr "op_type" "RR<E>,RI,RIL,RIL,RX<Y>,RXY,SIY") - (set_attr "cpu_facility" "*,*,extimm,extimm,*,*,z10")]) + (set_attr "cpu_facility" "*,*,extimm,extimm,*,*,z10") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1")]) ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi (define_insn "*add<mode>3_carry1_cc" @@ -4190,7 +4431,13 @@ al<y>\t%0,%2 al<g>si\t%0,%c2" [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY") - (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")]) + (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1")]) ; alr, al, aly, algr, alg (define_insn "*add<mode>3_carry1_cconly" @@ -4204,7 +4451,8 @@ al<g>r\t%0,%2 al<g>\t%0,%2 al<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi (define_insn "*add<mode>3_carry2_cc" @@ -4223,7 +4471,13 @@ al<y>\t%0,%2 al<g>si\t%0,%c2" [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY") - (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")]) + (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1")]) ; alr, al, aly, algr, alg (define_insn "*add<mode>3_carry2_cconly" @@ -4237,7 +4491,8 @@ al<g>r\t%0,%2 al<g>\t%0,%2 al<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; alr, alfi, slfi, al, aly, algr, algfi, slgfi, alg, alsi, algsi (define_insn "*add<mode>3_cc" @@ -4256,7 +4511,13 @@ al<y>\t%0,%2 al<g>si\t%0,%c2" [(set_attr "op_type" "RR<E>,RIL,RIL,RX<Y>,RXY,SIY") - (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10")]) + (set_attr "cpu_facility" "*,extimm,extimm,*,*,z10") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1")]) ; alr, al, aly, algr, alg (define_insn "*add<mode>3_cconly" @@ -4270,7 +4531,8 @@ al<g>r\t%0,%2 al<g>\t%0,%2 al<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; alr, al, aly, algr, alg (define_insn "*add<mode>3_cconly2" @@ -4283,7 +4545,8 @@ al<g>r\t%0,%2 al<g>\t%0,%2 al<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; ahi, afi, aghi, agfi, asi, agsi (define_insn "*add<mode>3_imm_cc" @@ -4303,7 +4566,8 @@ a<g>fi\t%0,%2 a<g>si\t%0,%c2" [(set_attr "op_type" "RI,RIL,SIY") - (set_attr "cpu_facility" "*,extimm,z10")]) + (set_attr "cpu_facility" "*,extimm,z10") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1")]) ; ; add(tf|df|sf|td|dd)3 instruction pattern(s). @@ -4320,7 +4584,7 @@ a<xde><bt>r\t%0,<op1>%2 a<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr (define_insn "*add<mode>3_cc" @@ -4335,7 +4599,7 @@ a<xde><bt>r\t%0,<op1>%2 a<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; axbr, adbr, aebr, axb, adb, aeb, adtr, axtr (define_insn "*add<mode>3_cconly" @@ -4349,7 +4613,7 @@ a<xde><bt>r\t%0,<op1>%2 a<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ;; @@ -4406,7 +4670,8 @@ "@ sgfr\t%0,%2 sgf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_c,*")]) (define_insn "*subdi3_zero_cc" [(set (reg CC_REGNUM) @@ -4419,7 +4684,8 @@ "@ slgfr\t%0,%2 slgf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) (define_insn "*subdi3_zero_cconly" [(set (reg CC_REGNUM) @@ -4431,7 +4697,8 @@ "@ slgfr\t%0,%2 slgf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) (define_insn "*subdi3_zero" [(set (match_operand:DI 0 "register_operand" "=d,d") @@ -4442,7 +4709,8 @@ "@ slgfr\t%0,%2 slgf\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1")]) (define_insn_and_split "*subdi3_31z" [(set (match_operand:DI 0 "register_operand" "=&d") @@ -4539,7 +4807,8 @@ s<g>r\t%0,%2 s<g>\t%0,%2 s<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_borrow_cc" @@ -4554,7 +4823,8 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_borrow_cconly" @@ -4568,7 +4838,8 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_cc" @@ -4583,7 +4854,8 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_cc2" @@ -4597,7 +4869,8 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_cconly" @@ -4611,7 +4884,9 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) + ; slr, sl, sly, slgr, slg (define_insn "*sub<mode>3_cconly2" @@ -4624,7 +4899,9 @@ sl<g>r\t%0,%2 sl<g>\t%0,%2 sl<y>\t%0,%2" - [(set_attr "op_type" "RR<E>,RX<Y>,RXY")]) + [(set_attr "op_type" "RR<E>,RX<Y>,RXY") + (set_attr "z10prop" "z10_super_c_E1,z10_super_E1,z10_super_E1")]) + ; ; sub(tf|df|sf|td|dd)3 instruction pattern(s). @@ -4641,7 +4918,7 @@ s<xde><bt>r\t%0,<op1>%2 s<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; sxbr, sdbr, sebr, sxb, sdb, seb, sxtr, sdtr (define_insn "*sub<mode>3_cc" @@ -4656,7 +4933,7 @@ s<xde><bt>r\t%0,<op1>%2 s<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; sxbr, sdbr, sebr, sxb, sdb, seb, sxtr, sdtr (define_insn "*sub<mode>3_cconly" @@ -4670,7 +4947,7 @@ s<xde><bt>r\t%0,<op1>%2 s<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ;; @@ -4793,7 +5070,8 @@ "@ slb<g>r\t%0,%2 slb<g>\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_c,*")]) ; slbr, slb, slbgr, slbg (define_insn "*sub<mode>3_slb" @@ -4806,7 +5084,8 @@ "@ slb<g>r\t%0,%2 slb<g>\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_c,*")]) (define_expand "add<mode>cc" [(match_operand:GPR 0 "register_operand" "") @@ -4814,9 +5093,9 @@ (match_operand:GPR 2 "register_operand" "") (match_operand:GPR 3 "const_int_operand" "")] "TARGET_CPU_ZARCH" - "if (!s390_expand_addcc (GET_CODE (operands[1]), - s390_compare_op0, s390_compare_op1, - operands[0], operands[2], + "if (!s390_expand_addcc (GET_CODE (operands[1]), + s390_compare_op0, s390_compare_op1, + operands[0], operands[2], operands[3])) FAIL; DONE;") ; @@ -4872,7 +5151,7 @@ [(set (match_dup 0) (xor:SI (match_dup 0) (const_int 1))) (clobber (reg:CC CC_REGNUM))])] "" -{ +{ if (!s390_compare_emitted || GET_MODE (s390_compare_emitted) != CCZ1mode) FAIL; operands[1] = s390_emit_compare (NE, s390_compare_op0, s390_compare_op1); @@ -4881,7 +5160,7 @@ (define_insn_and_split "*sne" [(set (match_operand:SI 0 "register_operand" "=d") - (ne:SI (match_operand:CCZ1 1 "register_operand" "0") + (ne:SI (match_operand:CCZ1 1 "register_operand" "0") (const_int 0))) (clobber (reg:CC CC_REGNUM))] "" @@ -4996,7 +5275,7 @@ ; mul(tf|df|sf|td|dd)3 instruction pattern(s). ; -; mxbr mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr +; mxbr, mdbr, meebr, mxb, mxb, meeb, mdtr, mxtr (define_insn "mul<mode>3" [(set (match_operand:FP 0 "register_operand" "=f,f") (mult:FP (match_operand:FP 1 "nonimmediate_operand" "%<f0>,0") @@ -5006,9 +5285,9 @@ m<xdee><bt>r\t%0,<op1>%2 m<xdee>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fmul<bfp>")]) + (set_attr "type" "fmul<mode>")]) -; maxbr, madbr, maebr, maxb, madb, maeb +; madbr, maebr, maxb, madb, maeb (define_insn "*fmadd<mode>" [(set (match_operand:DSF 0 "register_operand" "=f,f") (plus:DSF (mult:DSF (match_operand:DSF 1 "register_operand" "%f,f") @@ -5466,7 +5745,7 @@ d<xde><bt>r\t%0,<op1>%2 d<xde>b\t%0,%2" [(set_attr "op_type" "<RRer>,RXE") - (set_attr "type" "fdiv<bfp>")]) + (set_attr "type" "fdiv<mode>")]) ;; @@ -5496,7 +5775,8 @@ "@ ngr\t%0,%2 ng\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*anddi3_cconly" [(set (reg CC_REGNUM) @@ -5510,7 +5790,8 @@ "@ ngr\t%0,%2 ng\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1, z10_super_E1")]) (define_insn "*anddi3" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,d,d,AQ,Q") @@ -5534,7 +5815,19 @@ # #" [(set_attr "op_type" "RRE,RXE,RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS") - (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,*,*,*")]) + (set_attr "cpu_facility" "*,*,*,*,*,*,extimm,extimm,*,*,*,*") + (set_attr "z10prop" "*, + *, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + *, + *")]) (define_split [(set (match_operand:DI 0 "s_operand" "") @@ -5564,7 +5857,8 @@ nr\t%0,%2 n\t%0,%2 ny\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*andsi3_cconly" [(set (reg CC_REGNUM) @@ -5580,7 +5874,8 @@ nr\t%0,%2 n\t%0,%2 ny\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*andsi3_zarch" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q") @@ -5601,7 +5896,17 @@ ny\t%0,%2 # #" - [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS")]) + [(set_attr "op_type" "RRE,RXE,RI,RI,RIL,RR,RX,RXY,SI,SS") + (set_attr "z10prop" "*, + *, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + *, + *")]) (define_insn "*andsi3_esa" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q") @@ -5614,7 +5919,9 @@ n\t%0,%2 # #" - [(set_attr "op_type" "RR,RX,SI,SS")]) + [(set_attr "op_type" "RR,RX,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) + (define_split [(set (match_operand:SI 0 "s_operand" "") @@ -5641,7 +5948,9 @@ nill\t%0,%x2 # #" - [(set_attr "op_type" "RR,RI,SI,SS")]) + [(set_attr "op_type" "RR,RI,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*") +]) (define_insn "*andhi3_esa" [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q") @@ -5653,7 +5962,9 @@ nr\t%0,%2 # #" - [(set_attr "op_type" "RR,SI,SS")]) + [(set_attr "op_type" "RR,SI,SS") + (set_attr "z10prop" "z10_super_E1,*,*") +]) (define_split [(set (match_operand:HI 0 "s_operand" "") @@ -5681,7 +5992,8 @@ ni\t%S0,%b2 niy\t%S0,%b2 #" - [(set_attr "op_type" "RR,RI,SI,SIY,SS")]) + [(set_attr "op_type" "RR,RI,SI,SIY,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")]) (define_insn "*andqi3_esa" [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q") @@ -5693,7 +6005,8 @@ nr\t%0,%2 ni\t%S0,%b2 #" - [(set_attr "op_type" "RR,SI,SS")]) + [(set_attr "op_type" "RR,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super,*")]) ; ; Block and (NC) patterns. @@ -5742,7 +6055,7 @@ (clobber (reg:CC CC_REGNUM))])] "s390_offset_p (operands[0], operands[3], operands[2]) && s390_offset_p (operands[1], operands[4], operands[2]) - && !s390_overlap_p (operands[0], operands[1], + && !s390_overlap_p (operands[0], operands[1], INTVAL (operands[2]) + INTVAL (operands[5])) && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" [(parallel @@ -5781,7 +6094,8 @@ "@ ogr\t%0,%2 og\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*iordi3_cconly" [(set (reg CC_REGNUM) @@ -5793,7 +6107,8 @@ "@ ogr\t%0,%2 og\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*iordi3" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,d,d,d,d,AQ,Q") @@ -5814,7 +6129,17 @@ # #" [(set_attr "op_type" "RI,RI,RI,RI,RIL,RIL,RRE,RXY,SI,SS") - (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,*,*,*")]) + (set_attr "cpu_facility" "*,*,*,*,extimm,extimm,*,*,*,*") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + *, + *")]) (define_split [(set (match_operand:DI 0 "s_operand" "") @@ -5843,7 +6168,8 @@ or\t%0,%2 o\t%0,%2 oy\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*iorsi3_cconly" [(set (reg CC_REGNUM) @@ -5857,7 +6183,8 @@ or\t%0,%2 o\t%0,%2 oy\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*iorsi3_zarch" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,d,d,AQ,Q") @@ -5874,7 +6201,15 @@ oy\t%0,%2 # #" - [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS")]) + [(set_attr "op_type" "RI,RI,RIL,RR,RX,RXY,SI,SS") + (set_attr "z10prop" "z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + z10_super_E1, + *, + *")]) (define_insn "*iorsi3_esa" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,AQ,Q") @@ -5887,7 +6222,8 @@ o\t%0,%2 # #" - [(set_attr "op_type" "RR,RX,SI,SS")]) + [(set_attr "op_type" "RR,RX,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) (define_split [(set (match_operand:SI 0 "s_operand" "") @@ -5914,7 +6250,8 @@ oill\t%0,%x2 # #" - [(set_attr "op_type" "RR,RI,SI,SS")]) + [(set_attr "op_type" "RR,RI,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) (define_insn "*iorhi3_esa" [(set (match_operand:HI 0 "nonimmediate_operand" "=d,AQ,Q") @@ -5926,7 +6263,8 @@ or\t%0,%2 # #" - [(set_attr "op_type" "RR,SI,SS")]) + [(set_attr "op_type" "RR,SI,SS") + (set_attr "z10prop" "z10_super_E1,*,*")]) (define_split [(set (match_operand:HI 0 "s_operand" "") @@ -5954,7 +6292,8 @@ oi\t%S0,%b2 oiy\t%S0,%b2 #" - [(set_attr "op_type" "RR,RI,SI,SIY,SS")]) + [(set_attr "op_type" "RR,RI,SI,SIY,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")]) (define_insn "*iorqi3_esa" [(set (match_operand:QI 0 "nonimmediate_operand" "=d,Q,Q") @@ -5966,7 +6305,8 @@ or\t%0,%2 oi\t%S0,%b2 #" - [(set_attr "op_type" "RR,SI,SS")]) + [(set_attr "op_type" "RR,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super,*")]) ; ; Block inclusive or (OC) patterns. @@ -6015,7 +6355,7 @@ (clobber (reg:CC CC_REGNUM))])] "s390_offset_p (operands[0], operands[3], operands[2]) && s390_offset_p (operands[1], operands[4], operands[2]) - && !s390_overlap_p (operands[0], operands[1], + && !s390_overlap_p (operands[0], operands[1], INTVAL (operands[2]) + INTVAL (operands[5])) && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" [(parallel @@ -6054,7 +6394,8 @@ "@ xgr\t%0,%2 xg\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*xordi3_cconly" [(set (reg CC_REGNUM) @@ -6066,7 +6407,8 @@ "@ xgr\t%0,%2 xg\t%0,%2" - [(set_attr "op_type" "RRE,RXY")]) + [(set_attr "op_type" "RRE,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1")]) (define_insn "*xordi3" [(set (match_operand:DI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q") @@ -6082,7 +6424,8 @@ # #" [(set_attr "op_type" "RIL,RIL,RRE,RXY,SI,SS") - (set_attr "cpu_facility" "extimm,extimm,*,*,*,*")]) + (set_attr "cpu_facility" "extimm,extimm,*,*,*,*") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1,*,*")]) (define_split [(set (match_operand:DI 0 "s_operand" "") @@ -6111,7 +6454,8 @@ xr\t%0,%2 x\t%0,%2 xy\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*xorsi3_cconly" [(set (reg CC_REGNUM) @@ -6125,7 +6469,8 @@ xr\t%0,%2 x\t%0,%2 xy\t%0,%2" - [(set_attr "op_type" "RIL,RR,RX,RXY")]) + [(set_attr "op_type" "RIL,RR,RX,RXY") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1")]) (define_insn "*xorsi3" [(set (match_operand:SI 0 "nonimmediate_operand" "=d,d,d,d,AQ,Q") @@ -6140,7 +6485,8 @@ xy\t%0,%2 # #" - [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS")]) + [(set_attr "op_type" "RIL,RR,RX,RXY,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super_E1,z10_super_E1,*,*")]) (define_split [(set (match_operand:SI 0 "s_operand" "") @@ -6167,7 +6513,8 @@ xr\t%0,%2 # #" - [(set_attr "op_type" "RIL,RR,SI,SS")]) + [(set_attr "op_type" "RIL,RR,SI,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,*,*")]) (define_split [(set (match_operand:HI 0 "s_operand" "") @@ -6195,7 +6542,9 @@ xi\t%S0,%b2 xiy\t%S0,%b2 #" - [(set_attr "op_type" "RIL,RR,SI,SIY,SS")]) + [(set_attr "op_type" "RIL,RR,SI,SIY,SS") + (set_attr "z10prop" "z10_super_E1,z10_super_E1,z10_super,z10_super,*")]) + ; ; Block exclusive or (XC) patterns. @@ -6244,7 +6593,7 @@ (clobber (reg:CC CC_REGNUM))])] "s390_offset_p (operands[0], operands[3], operands[2]) && s390_offset_p (operands[1], operands[4], operands[2]) - && !s390_overlap_p (operands[0], operands[1], + && !s390_overlap_p (operands[0], operands[1], INTVAL (operands[2]) + INTVAL (operands[5])) && INTVAL (operands[2]) + INTVAL (operands[5]) <= 256" [(parallel @@ -6316,7 +6665,7 @@ "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)" "lcgfr\t%0,%1" [(set_attr "op_type" "RRE")]) - + (define_insn "*negdi2_sign" [(set (match_operand:DI 0 "register_operand" "=d") (neg:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d")))) @@ -6334,7 +6683,8 @@ (neg:GPR (match_dup 1)))] "s390_match_ccmode (insn, CCAmode)" "lc<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_super_c_E1")]) ; lcr, lcgr (define_insn "*neg<mode>2_cconly" @@ -6344,7 +6694,8 @@ (clobber (match_scratch:GPR 0 "=d"))] "s390_match_ccmode (insn, CCAmode)" "lc<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_super_c_E1")]) ; lcr, lcgr (define_insn "*neg<mode>2" @@ -6353,7 +6704,8 @@ (clobber (reg:CC CC_REGNUM))] "" "lc<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_super_c_E1")]) (define_insn_and_split "*negdi2_31" [(set (match_operand:DI 0 "register_operand" "=d") @@ -6425,7 +6777,7 @@ "TARGET_HARD_FLOAT && TARGET_DFP" "lcdfr\t%0,%1" [(set_attr "op_type" "RRE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; lcxbr, lcdbr, lcebr (define_insn "*neg<mode>2" @@ -6475,9 +6827,10 @@ (abs:GPR (match_dup 1)))] "s390_match_ccmode (insn, CCAmode)" "lp<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) -; lpr, lpgr +; lpr, lpgr (define_insn "*abs<mode>2_cconly" [(set (reg CC_REGNUM) (compare (abs:GPR (match_operand:GPR 1 "register_operand" "d")) @@ -6485,7 +6838,8 @@ (clobber (match_scratch:GPR 0 "=d"))] "s390_match_ccmode (insn, CCAmode)" "lp<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) ; lpr, lpgr (define_insn "abs<mode>2" @@ -6494,7 +6848,8 @@ (clobber (reg:CC CC_REGNUM))] "" "lp<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) ; ; abs(df|sf)2 instruction pattern(s). @@ -6538,7 +6893,7 @@ "TARGET_HARD_FLOAT && TARGET_DFP" "lpdfr\t%0,%1" [(set_attr "op_type" "RRE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; lpxbr, lpdbr, lpebr (define_insn "*abs<mode>2" @@ -6570,7 +6925,7 @@ "TARGET_64BIT && s390_match_ccmode (insn, CCAmode)" "lngfr\t%0,%1" [(set_attr "op_type" "RRE")]) - + (define_insn "*negabsdi2_sign" [(set (match_operand:DI 0 "register_operand" "=d") (neg:DI (abs:DI (sign_extend:DI @@ -6589,7 +6944,8 @@ (neg:GPR (abs:GPR (match_dup 1))))] "s390_match_ccmode (insn, CCAmode)" "ln<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) ; lnr, lngr (define_insn "*negabs<mode>2_cconly" @@ -6599,7 +6955,8 @@ (clobber (match_scratch:GPR 0 "=d"))] "s390_match_ccmode (insn, CCAmode)" "ln<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) ; lnr, lngr (define_insn "*negabs<mode>2" @@ -6608,7 +6965,8 @@ (clobber (reg:CC CC_REGNUM))] "" "ln<g>r\t%0,%1" - [(set_attr "op_type" "RR<E>")]) + [(set_attr "op_type" "RR<E>") + (set_attr "z10prop" "z10_c")]) ; ; Floating point @@ -6644,7 +7002,7 @@ "TARGET_HARD_FLOAT && TARGET_DFP" "lndfr\t%0,%1" [(set_attr "op_type" "RRE") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ; lnxbr, lndbr, lnebr (define_insn "*negabs<mode>2" @@ -6664,12 +7022,12 @@ (define_insn "copysign<mode>3" [(set (match_operand:FP 0 "register_operand" "=f") (unspec:FP [(match_operand:FP 1 "register_operand" "<fT0>") - (match_operand:FP 2 "register_operand" "f")] + (match_operand:FP 2 "register_operand" "f")] UNSPEC_COPYSIGN))] "TARGET_HARD_FLOAT && TARGET_DFP" "cpsdr\t%0,%2,%1" [(set_attr "op_type" "RRF") - (set_attr "type" "fsimp<bfp>")]) + (set_attr "type" "fsimp<mode>")]) ;; ;;- Square root instructions. @@ -6679,7 +7037,7 @@ ; sqrt(df|sf)2 instruction pattern(s). ; -; sqxbr, sqdbr, sqebr, sqxb, sqdb, sqeb +; sqxbr, sqdbr, sqebr, sqdb, sqeb (define_insn "sqrt<mode>2" [(set (match_operand:BFP 0 "register_operand" "=f,f") (sqrt:BFP (match_operand:BFP 1 "general_operand" "f,<Rf>")))] @@ -6726,7 +7084,7 @@ emit_insn (gen_clztidi2 (wide_reg, operands[1], msb)); - insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg)); + insn = emit_move_insn (operands[0], gen_highpart (DImode, wide_reg)); set_unique_reg_note (insn, REG_EQUAL, clz_equal); DONE; @@ -6735,16 +7093,16 @@ (define_insn "clztidi2" [(set (match_operand:TI 0 "register_operand" "=d") (ior:TI - (ashift:TI - (zero_extend:TI + (ashift:TI + (zero_extend:TI (xor:DI (match_operand:DI 1 "register_operand" "d") (lshiftrt (match_operand:DI 2 "const_int_operand" "") (subreg:SI (clz:DI (match_dup 1)) 4)))) - + (const_int 64)) (zero_extend:TI (clz:DI (match_dup 1))))) (clobber (reg:CC CC_REGNUM))] - "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) + "(unsigned HOST_WIDE_INT) INTVAL (operands[2]) == (unsigned HOST_WIDE_INT) 1 << 63 && TARGET_EXTIMM && TARGET_64BIT" "flogr\t%0,%1" @@ -6767,7 +7125,8 @@ "TARGET_CPU_ZARCH" "rll<g>\t%0,%1,%Y2" [(set_attr "op_type" "RSE") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; rll, rllg (define_insn "*rotl<mode>3_and" @@ -6778,7 +7137,8 @@ "TARGET_CPU_ZARCH && (INTVAL (operands[3]) & 63) == 63" "rll<g>\t%0,%1,%Y2" [(set_attr "op_type" "RSE") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ;; @@ -6814,7 +7174,8 @@ "" "s<lr>l<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; sldl, srdl (define_insn "*<shift>di3_31_and" @@ -6836,7 +7197,8 @@ "(INTVAL (operands[3]) & 63) == 63" "s<lr>l<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; ; ashr(di|si)3 instruction pattern(s). @@ -6895,7 +7257,8 @@ "s390_match_ccmode(insn, CCSmode)" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; sra, srag (define_insn "*ashr<mode>3_cconly" @@ -6907,7 +7270,8 @@ "s390_match_ccmode(insn, CCSmode)" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; sra, srag (define_insn "*ashr<mode>3" @@ -6918,7 +7282,8 @@ "" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; shift pattern with implicit ANDs @@ -6973,7 +7338,8 @@ "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; sra, srag (define_insn "*ashr<mode>3_cconly_and" @@ -6986,7 +7352,8 @@ "s390_match_ccmode(insn, CCSmode) && (INTVAL (operands[3]) & 63) == 63" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ; sra, srag (define_insn "*ashr<mode>3_and" @@ -6998,7 +7365,8 @@ "(INTVAL (operands[3]) & 63) == 63" "sra<g>\t%0,<1>%Y2" [(set_attr "op_type" "RS<E>") - (set_attr "atype" "reg")]) + (set_attr "atype" "reg") + (set_attr "z10prop" "z10_super_E1")]) ;; @@ -7158,7 +7526,7 @@ "" { if (operands[1] != const0_rtx) FAIL; - operands[0] = s390_emit_compare (GET_CODE (operands[0]), + operands[0] = s390_emit_compare (GET_CODE (operands[0]), s390_compare_op0, s390_compare_op1); }) @@ -7181,7 +7549,8 @@ c<g>rt%C0\t%1,%2 c<g>it%C0\t%1,%h2" [(set_attr "op_type" "RRF,RIE") - (set_attr "type" "branch")]) + (set_attr "type" "branch") + (set_attr "z10prop" "z10_c,*")]) ; clrt, clgrt, clfit, clgit (define_insn "*cmp_and_trap_unsigned_int<mode>" @@ -7194,7 +7563,8 @@ cl<g>rt%C0\t%1,%2 cl<gf>it%C0\t%1,%x2" [(set_attr "op_type" "RRF,RIE") - (set_attr "type" "branch")]) + (set_attr "type" "branch") + (set_attr "z10prop" "z10_c,*")]) ;; ;;- Loop instructions. @@ -7256,6 +7626,9 @@ (pc)))] "" [(set_attr "op_type" "RI") + ; Strictly speaking, the z10 properties are valid for brct only, however, it does not + ; hurt us in the (rare) case of ahi. + (set_attr "z10prop" "z10_super") (set_attr "type" "branch") (set (attr "length") (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) @@ -7295,6 +7668,9 @@ (pc)))] "" [(set_attr "op_type" "RI") + ; Strictly speaking, the z10 properties are valid for brct only, however, it does not + ; hurt us in the (rare) case of ahi. + (set_attr "z10prop" "z10_super") (set_attr "type" "branch") (set (attr "length") (if_then_else (eq (symbol_ref "flag_pic") (const_int 0)) @@ -7361,6 +7737,9 @@ (pc)))] "" [(set_attr "op_type" "RI") + ; Strictly speaking, the z10 properties are valid for brct only, however, it does not + ; hurt us in the (rare) case of ahi. + (set_attr "z10prop" "z10_super") (set_attr "type" "branch") (set (attr "length") (if_then_else (lt (abs (minus (pc) (match_dup 0))) (const_int 60000)) @@ -7427,7 +7806,8 @@ (if_then_else (match_operand 0 "register_operand" "") (const_string "RR") (const_string "RX"))) (set_attr "type" "branch") - (set_attr "atype" "agen")]) + (set_attr "atype" "agen") + (set_attr "z10prop" "z10_super")]) ; ; casesi instruction pattern(s). @@ -7770,7 +8150,8 @@ UNSPEC_TLS_LOAD))] "TARGET_64BIT" "lg\t%0,%1%J2" - [(set_attr "op_type" "RXE")]) + [(set_attr "op_type" "RXE") + (set_attr "z10prop" "z10_fwd_A3")]) (define_insn "*tls_load_31" [(set (match_operand:SI 0 "register_operand" "=d,d") @@ -7781,7 +8162,8 @@ "@ l\t%0,%1%J2 ly\t%0,%1%J2" - [(set_attr "op_type" "RX,RXY")]) + [(set_attr "op_type" "RX,RXY") + (set_attr "z10prop" "z10_fwd_A3,z10_fwd_A3")]) (define_insn "*bras_tls" [(set (match_operand 0 "" "") @@ -7851,6 +8233,8 @@ "" "bcr\t15,0" [(set_attr "op_type" "RR")]) +; Although bcr is superscalar on Z10, this variant will never become part of +; an execution group. ; ; compare and swap patterns. @@ -7883,7 +8267,7 @@ (set (reg:CCZ1 CC_REGNUM) (compare:CCZ1 (match_dup 1) (match_dup 2)))])] "" - "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], + "s390_expand_cs_hqi (<MODE>mode, operands[0], operands[1], operands[2], operands[3]); DONE;") (define_expand "sync_compare_and_swap_cc<mode>" @@ -7936,7 +8320,7 @@ UNSPECV_CAS)) (set (reg:CCZ1 CC_REGNUM) (compare:CCZ1 (match_dup 1) (match_dup 2)))] - "" + "" "cs<g>\t%0,%3,%S1" [(set_attr "op_type" "RS<E>") (set_attr "type" "sem")]) @@ -7951,7 +8335,7 @@ (match_operand:HQI 1 "memory_operand") (match_operand:HQI 2 "general_operand")] "" - "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1], + "s390_expand_atomic (<MODE>mode, SET, operands[0], operands[1], operands[2], false); DONE;") (define_expand "sync_<atomic><mode>" @@ -7959,7 +8343,7 @@ (ATOMIC:HQI (match_dup 0) (match_operand:HQI 1 "general_operand")))] "" - "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0], + "s390_expand_atomic (<MODE>mode, <CODE>, NULL_RTX, operands[0], operands[1], false); DONE;") (define_expand "sync_old_<atomic><mode>" @@ -7969,16 +8353,16 @@ (ATOMIC:HQI (match_dup 1) (match_operand:HQI 2 "general_operand")))] "" - "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], + "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], operands[2], false); DONE;") (define_expand "sync_new_<atomic><mode>" [(set (match_operand:HQI 0 "register_operand") (ATOMIC:HQI (match_operand:HQI 1 "memory_operand") - (match_operand:HQI 2 "general_operand"))) + (match_operand:HQI 2 "general_operand"))) (set (match_dup 1) (ATOMIC:HQI (match_dup 1) (match_dup 2)))] "" - "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], + "s390_expand_atomic (<MODE>mode, <CODE>, operands[0], operands[1], operands[2], true); DONE;") ;; @@ -8090,7 +8474,7 @@ if (TARGET_BACKCHAIN) temp = force_reg (Pmode, operand_subword (operands[1], 0, 0, mode)); - + emit_move_insn (base, operand_subword (operands[1], 2, 0, mode)); emit_move_insn (operands[0], operand_subword (operands[1], 1, 0, mode)); @@ -8178,7 +8562,8 @@ "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode" "larl\t%0,%1" [(set_attr "op_type" "RIL") - (set_attr "type" "larl")]) + (set_attr "type" "larl") + (set_attr "z10prop" "z10_super_A1")]) (define_insn "main_pool" [(set (match_operand 0 "register_operand" "=a") @@ -8187,7 +8572,7 @@ { gcc_unreachable (); } - [(set (attr "type") + [(set (attr "type") (if_then_else (ne (symbol_ref "TARGET_CPU_ZARCH") (const_int 0)) (const_string "larl") (const_string "la")))]) @@ -8205,7 +8590,8 @@ "TARGET_CPU_ZARCH && GET_MODE (operands[0]) == Pmode" "larl\t%0,%1" [(set_attr "op_type" "RIL") - (set_attr "type" "larl")]) + (set_attr "type" "larl") + (set_attr "z10prop" "z10_super_A1")]) (define_insn "pool" [(unspec_volatile [(match_operand 0 "const_int_operand" "n")] UNSPECV_POOL)] @@ -8366,6 +8752,7 @@ instruction. */ return ""; - -} [(set_attr "type" "load,larl") - (set_attr "op_type" "RXY,RIL")]) +} + [(set_attr "type" "load,larl") + (set_attr "op_type" "RXY,RIL") + (set_attr "z10prop" "z10_super")]) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e34fb2270a9..29159480da5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/34485 + * pt.c (check_template_shadow): Change to return a bool. + * name-lookup.c (push_class_level_binding): Early return if + check_template_shadow returns false. + * cp-tree.h (check_template_shadow): Adjust declaration. + +2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/34600 + * decl.c (grokdeclarator): In case of extern and initializer, return + error_mark_node after the error. + 2008-08-13 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 30551 diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 4b4bf335836..a80027ef27d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4450,7 +4450,7 @@ extern tree locate_dtor (tree, void *); extern bool maybe_clone_body (tree); /* in pt.c */ -extern void check_template_shadow (tree); +extern bool check_template_shadow (tree); extern tree get_innermost_template_args (tree, int); extern void maybe_begin_member_template_processing (tree); extern void maybe_end_member_template_processing (void); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 3cd251128f1..b0531604d02 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -9270,7 +9270,10 @@ grokdeclarator (const cp_declarator *declarator, warning (0, "%qs initialized and declared %<extern%>", name); } else - error ("%qs has both %<extern%> and initializer", name); + { + error ("%qs has both %<extern%> and initializer", name); + return error_mark_node; + } } /* Record `register' declaration for warnings on & diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 9b456d54c57..60050b8f339 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2753,7 +2753,8 @@ push_class_level_binding (tree name, tree x) && TREE_TYPE (decl) == error_mark_node) decl = TREE_VALUE (decl); - check_template_shadow (decl); + if (!check_template_shadow (decl)) + POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, false); /* [class.mem] diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 6e4f0ba447b..4a9e571a70a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2809,12 +2809,15 @@ expand_template_argument_pack (tree args) return result_args; } -/* Complain if DECL shadows a template parameter. +/* Checks if DECL shadows a template parameter. [temp.local]: A template-parameter shall not be redeclared within its - scope (including nested scopes). */ + scope (including nested scopes). -void + Emits an error and returns TRUE if the DECL shadows a parameter, + returns FALSE otherwise. */ + +bool check_template_shadow (tree decl) { tree olddecl; @@ -2822,7 +2825,7 @@ check_template_shadow (tree decl) /* If we're not in a template, we can't possibly shadow a template parameter. */ if (!current_template_parms) - return; + return true; /* Figure out what we're shadowing. */ if (TREE_CODE (decl) == OVERLOAD) @@ -2832,24 +2835,25 @@ check_template_shadow (tree decl) /* If there's no previous binding for this name, we're not shadowing anything, let alone a template parameter. */ if (!olddecl) - return; + return true; /* If we're not shadowing a template parameter, we're done. Note that OLDDECL might be an OVERLOAD (or perhaps even an ERROR_MARK), so we can't just blithely assume it to be a _DECL node. */ if (!DECL_P (olddecl) || !DECL_TEMPLATE_PARM_P (olddecl)) - return; + return true; /* We check for decl != olddecl to avoid bogus errors for using a name inside a class. We check TPFI to avoid duplicate errors for inline member templates. */ if (decl == olddecl || TEMPLATE_PARMS_FOR_INLINE (current_template_parms)) - return; + return true; error ("declaration of %q+#D", decl); error (" shadows template parm %q+#D", olddecl); + return false; } /* Return a new TEMPLATE_PARM_INDEX with the indicated INDEX, LEVEL, diff --git a/gcc/expr.c b/gcc/expr.c index 7cc8783e0bc..1d994c55b08 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8157,26 +8157,89 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, return REDUCE_BIT_FIELD (op0); case VIEW_CONVERT_EXPR: - op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier); + op0 = NULL_RTX; + + /* If we are converting to BLKmode, try to avoid an intermediate + temporary by fetching an inner memory reference. */ + if (mode == BLKmode + && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST + && TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))) != BLKmode + && handled_component_p (TREE_OPERAND (exp, 0))) + { + enum machine_mode mode1; + HOST_WIDE_INT bitsize, bitpos; + tree offset; + int unsignedp; + int volatilep = 0; + tree tem + = get_inner_reference (TREE_OPERAND (exp, 0), &bitsize, &bitpos, + &offset, &mode1, &unsignedp, &volatilep, + true); + rtx orig_op0; + + /* ??? We should work harder and deal with non-zero offsets. */ + if (!offset + && (bitpos % BITS_PER_UNIT) == 0 + && bitsize >= 0 + && compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) == 0) + { + /* See the normal_inner_ref case for the rationale. */ + orig_op0 + = expand_expr (tem, + (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE + && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) + != INTEGER_CST) + && modifier != EXPAND_STACK_PARM + ? target : NULL_RTX), + VOIDmode, + (modifier == EXPAND_INITIALIZER + || modifier == EXPAND_CONST_ADDRESS + || modifier == EXPAND_STACK_PARM) + ? modifier : EXPAND_NORMAL); + + if (MEM_P (orig_op0)) + { + op0 = orig_op0; + + /* Get a reference to just this component. */ + if (modifier == EXPAND_CONST_ADDRESS + || modifier == EXPAND_SUM + || modifier == EXPAND_INITIALIZER) + op0 = adjust_address_nv (op0, mode, bitpos / BITS_PER_UNIT); + else + op0 = adjust_address (op0, mode, bitpos / BITS_PER_UNIT); + + if (op0 == orig_op0) + op0 = copy_rtx (op0); + + set_mem_attributes (op0, TREE_OPERAND (exp, 0), 0); + if (REG_P (XEXP (op0, 0))) + mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0)); + + MEM_VOLATILE_P (op0) |= volatilep; + } + } + } + + if (!op0) + op0 = expand_expr (TREE_OPERAND (exp, 0), NULL_RTX, mode, modifier); /* If the input and output modes are both the same, we are done. */ - if (TYPE_MODE (type) == GET_MODE (op0)) + if (mode == GET_MODE (op0)) ; /* If neither mode is BLKmode, and both modes are the same size then we can use gen_lowpart. */ - else if (TYPE_MODE (type) != BLKmode && GET_MODE (op0) != BLKmode - && GET_MODE_SIZE (TYPE_MODE (type)) - == GET_MODE_SIZE (GET_MODE (op0))) + else if (mode != BLKmode && GET_MODE (op0) != BLKmode + && GET_MODE_SIZE (mode) == GET_MODE_SIZE (GET_MODE (op0))) { if (GET_CODE (op0) == SUBREG) op0 = force_reg (GET_MODE (op0), op0); - op0 = gen_lowpart (TYPE_MODE (type), op0); + op0 = gen_lowpart (mode, op0); } /* If both modes are integral, then we can convert from one to the other. */ - else if (SCALAR_INT_MODE_P (GET_MODE (op0)) - && SCALAR_INT_MODE_P (TYPE_MODE (type))) - op0 = convert_modes (TYPE_MODE (type), GET_MODE (op0), op0, + else if (SCALAR_INT_MODE_P (GET_MODE (op0)) && SCALAR_INT_MODE_P (mode)) + op0 = convert_modes (mode, GET_MODE (op0), op0, TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))); /* As a last resort, spill op0 to memory, and reload it in a different mode. */ @@ -8200,8 +8263,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, op0 = target; } - /* At this point, OP0 is in the correct mode. If the output type is such - that the operand is known to be aligned, indicate that it is. + /* At this point, OP0 is in the correct mode. If the output type is + such that the operand is known to be aligned, indicate that it is. Otherwise, we need only be concerned about alignment for non-BLKmode results. */ if (MEM_P (op0)) @@ -8210,22 +8273,24 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, if (TYPE_ALIGN_OK (type)) set_mem_align (op0, MAX (MEM_ALIGN (op0), TYPE_ALIGN (type))); - else if (TYPE_MODE (type) != BLKmode && STRICT_ALIGNMENT - && MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (TYPE_MODE (type))) + else if (STRICT_ALIGNMENT + && mode != BLKmode + && MEM_ALIGN (op0) < GET_MODE_ALIGNMENT (mode)) { tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0)); HOST_WIDE_INT temp_size = MAX (int_size_in_bytes (inner_type), - (HOST_WIDE_INT) GET_MODE_SIZE (TYPE_MODE (type))); - rtx new_rtx = assign_stack_temp_for_type (TYPE_MODE (type), - temp_size, 0, type); - rtx new_with_op0_mode = adjust_address (new_rtx, GET_MODE (op0), 0); + (HOST_WIDE_INT) GET_MODE_SIZE (mode)); + rtx new_rtx + = assign_stack_temp_for_type (mode, temp_size, 0, type); + rtx new_with_op0_mode + = adjust_address (new_rtx, GET_MODE (op0), 0); gcc_assert (!TREE_ADDRESSABLE (exp)); if (GET_MODE (op0) == BLKmode) emit_block_move (new_with_op0_mode, op0, - GEN_INT (GET_MODE_SIZE (TYPE_MODE (type))), + GEN_INT (GET_MODE_SIZE (mode)), (modifier == EXPAND_STACK_PARM ? BLOCK_OP_CALL_PARM : BLOCK_OP_NORMAL)); else @@ -8234,7 +8299,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, op0 = new_rtx; } - op0 = adjust_address (op0, TYPE_MODE (type), 0); + op0 = adjust_address (op0, mode, 0); } return op0; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3bdfb527f6b..8ca3f84aad7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,21 @@ +2008-08-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/36825 + * libgfortran.h: Reduce GFC_MAX_DIMENSIONS to 7. + +2008-08-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/35863 + * io.c (gfc_match_open): Enable UTF-8 in checks. + * simplify.c (gfc_simplify_selected_char_kind): Enable iso_10646. + +2008-08-14 Janus Weil <janus@gcc.gnu.org> + + PR fortran/36705 + * symbol.c (check_conflict): Move conflict checks for (procedure,save) + and (procedure,intent) to resolve_fl_procedure. + * resolve.c (resolve_fl_procedure): Ditto. + 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 58326b707f5..979dfc20aa3 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -1706,8 +1706,7 @@ gfc_match_open (void) if (open->encoding->expr_type == EXPR_CONSTANT) { - /* TODO: Implement UTF-8 here. */ - static const char * encoding[] = { "DEFAULT", NULL }; + static const char * encoding[] = { "DEFAULT", "UTF-8", NULL }; if (!compare_to_allowed_values ("ENCODING", encoding, NULL, NULL, open->encoding->value.character.string, diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h index ccae391aebb..74bb9a92fcf 100644 --- a/gcc/fortran/libgfortran.h +++ b/gcc/fortran/libgfortran.h @@ -88,7 +88,9 @@ libgfortran_error_codes; #define GFC_STDERR_UNIT_NUMBER 0 -#define GFC_MAX_DIMENSIONS 15 +/* FIXME: Increase to 15 for Fortran 2008. Also needs changes to + GFC_DTYPE_RANK_MASK. See PR 36825. */ +#define GFC_MAX_DIMENSIONS 7 #define GFC_DTYPE_RANK_MASK 0x07 #define GFC_DTYPE_TYPE_SHIFT 3 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index c6a241a8545..994cb71151a 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -7443,6 +7443,20 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) } } + if (sym->attr.save == SAVE_EXPLICIT && !sym->attr.proc_pointer) + { + gfc_error ("PROCEDURE attribute conflicts with SAVE attribute " + "in '%s' at %L", sym->name, &sym->declared_at); + return FAILURE; + } + + if (sym->attr.intent && !sym->attr.proc_pointer) + { + gfc_error ("PROCEDURE attribute conflicts with INTENT attribute " + "in '%s' at %L", sym->name, &sym->declared_at); + return FAILURE; + } + return SUCCESS; } diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c index 1690003dbac..64d2be190f9 100644 --- a/gcc/fortran/simplify.c +++ b/gcc/fortran/simplify.c @@ -3795,6 +3795,8 @@ gfc_simplify_selected_char_kind (gfc_expr *e) if (gfc_compare_with_Cstring (e, "ascii", false) == 0 || gfc_compare_with_Cstring (e, "default", false) == 0) kind = 1; + else if (gfc_compare_with_Cstring (e, "iso_10646", false) == 0) + kind = 4; else kind = -1; diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 6b64bcf4353..d564dd7782f 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -417,12 +417,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) goto conflict; case FL_PROCEDURE: - if (attr->proc_pointer) - break; - a1 = gfc_code2string (flavors, attr->flavor); - a2 = save; - goto conflict; - + /* Conflicts between SAVE and PROCEDURE will be checked at + resolution stage, see "resolve_fl_procedure". */ case FL_VARIABLE: case FL_NAMELIST: default: @@ -618,8 +614,8 @@ check_conflict (symbol_attribute *attr, const char *name, locus *where) break; case FL_PROCEDURE: - if (!attr->proc_pointer) - conf2 (intent); + /* Conflicts with INTENT will be checked at resolution stage, + see "resolve_fl_procedure". */ if (attr->subroutine) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdbc3542e9e..fe96594951d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,58 @@ +2008-08-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/36825 + * gfortran.dg/rank_1.f90: Modify error message. + +2008-08-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/35863 + * gfortran.dg/utf8_1.f03: New test. + * gfortran.dg/utf8_2.f03: New test. + +2008-08-15 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + * gcc.dg/pr30551-6.c: Skip for SPU. + * gcc.dg/pr30551-3.c: Likewise. + * gcc.dg/pr30551.c: Likewise. + * g++.dg/warn/pr30551-2.C: Likewise. + * g++.dg/warn/pr30551.C: Likewise. + +2008-08-14 Janus Weil <janus@gcc.gnu.org> + + PR fortran/36705 + * gfortran.dg/argument_checking_7.f90: Modified. + * gfortran.dg/conflicts.f90: Modified. + * gfortran.dg/proc_decl_1.f90: Modified. + * gfortran.dg/proc_ptr_9.f90: New. + +2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/34485 + * g++.dg/template/crash81.C: New. + * g++.old-deja/g++.benjamin/tem03.C: Adjust. + * g++.old-deja/g++.benjamin/tem04.C: Likewise. + * g++.old-deja/g++.brendan/crash7.C: Likewise. + +2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/36886 + * gfortran.dg/cshift_char_3.f90: New test case. + * gfortran.dg/cshift_nan_1.f90: New test case. + +2008-08-14 Rafael Avila de Espindola <espindola@google.com> + + * gcc.dg/visibility-14.c: New test. + * gcc.dg/visibility-15.c: New test. + * gcc.dg/visibility-16.c: New test. + * gcc.dg/visibility-17.c: New test. + * gcc.dg/visibility-18.c: New test. + * gcc.dg/visibility-19.c: New test. + +2008-08-14 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/34600 + * g++.dg/parse/crash43.C: New. + 2008-08-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c/28152 diff --git a/gcc/testsuite/g++.dg/parse/crash43.C b/gcc/testsuite/g++.dg/parse/crash43.C new file mode 100644 index 00000000000..84fe8c5186c --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash43.C @@ -0,0 +1,9 @@ +// PR c++/34600 + +namespace N +{ + void foo() + { + extern int i = 0; // { dg-error "error: 'i' has both 'extern' and initializer" } + } +} diff --git a/gcc/testsuite/g++.dg/template/crash81.C b/gcc/testsuite/g++.dg/template/crash81.C new file mode 100644 index 00000000000..f2b76744f33 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash81.C @@ -0,0 +1,6 @@ +// PR c++/34485 + +struct A +{ + template<T::X> struct X; // { dg-error "error: 'T' has not been declared|error: declaration of 'template<int X> struct A::X'|error: shadows template parm 'int X'" } +}; diff --git a/gcc/testsuite/g++.dg/warn/pr30551-2.C b/gcc/testsuite/g++.dg/warn/pr30551-2.C index 7a4b136579d..911449d7a0f 100644 --- a/gcc/testsuite/g++.dg/warn/pr30551-2.C +++ b/gcc/testsuite/g++.dg/warn/pr30551-2.C @@ -1,6 +1,6 @@ // PR 30551 -Wmain is enabled by -pedantic/-pedantic-errors. // { dg-do compile } // { dg-options "-pedantic-errors" } - +// { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } } int main(char a) {} /* { dg-error "error: first argument of .*main.* should be .int." } */ /* { dg-error "error: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/g++.dg/warn/pr30551.C b/gcc/testsuite/g++.dg/warn/pr30551.C index ed9248744db..e9144d5984f 100644 --- a/gcc/testsuite/g++.dg/warn/pr30551.C +++ b/gcc/testsuite/g++.dg/warn/pr30551.C @@ -1,6 +1,6 @@ // PR 30551 -Wmain is enabled by default. // { dg-do compile } // { dg-options "" } - +// { dg-skip-if "-Wmain not enabled on SPU" { spu-*-* } } int main(char a) {} /* { dg-warning "warning: first argument of .*main.* should be .int." } */ /* { dg-warning "warning: .*main.* takes only zero or two arguments" "" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C index 73b99659e12..8f7459f17fb 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem03.C @@ -83,7 +83,7 @@ public: template <class T10, int i> struct Xfour {// { dg-error "" } .* int T10; // { dg-error "" } .* void f(){ - char T10; + char T10; // { dg-error "error: declaration of 'char T10'" } } }; @@ -123,11 +123,11 @@ public: template <class U> friend bool fooy(U u); - template <class T161> + template <class T161> // { dg-error "error: declaration of 'class T161'" } friend bool foo(T161 u) { - Xseven<T161, 5, int> obj; // { dg-error "" } .* - return (obj.inst == u.inst); // { dg-error "" } .* + Xseven<T161, 5, int> obj; + return (obj.inst == u.inst); } }; diff --git a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C index d486efbbaef..7dd7462c334 100644 --- a/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C +++ b/gcc/testsuite/g++.old-deja/g++.benjamin/tem04.C @@ -91,7 +91,7 @@ public: template <typename T14, template <typename T15> class C12>// { dg-error "" } .* class Xeighteen { protected: - C12<T14> value; // { dg-error "" } + C12<T14> value; int C12; // { dg-error "" } .* }; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C index 99fee519f52..d53dee77dd3 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash7.C @@ -44,5 +44,5 @@ void Sort<Comp>::sort (Vector<Comp::T> &v)// { dg-error "" } use of bad T void f (Vector<int> &vi) { - Sort<Comparator<int> >::sort (vi); + Sort<Comparator<int> >::sort (vi); // { dg-error "error: 'sort' is not a member of 'Sort<Comparator<int> >'" } } diff --git a/gcc/testsuite/gcc.dg/pr30551-3.c b/gcc/testsuite/gcc.dg/pr30551-3.c index 120d45b8393..bc33187e50b 100644 --- a/gcc/testsuite/gcc.dg/pr30551-3.c +++ b/gcc/testsuite/gcc.dg/pr30551-3.c @@ -1,7 +1,7 @@ /* PR 30551 -Wmain is enabled by -pedantic-errors. */ /* { dg-do compile } */ /* { dg-options "-pedantic-errors" } */ - +/* { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } } */ void main(char a) {} /* { dg-error "first argument of .main. should be .int." } */ /* { dg-error ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */ /* { dg-error "return type of .main. is not .int." "" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/gcc.dg/pr30551-6.c b/gcc/testsuite/gcc.dg/pr30551-6.c index 9c33cd143dd..48824e3a9d0 100644 --- a/gcc/testsuite/gcc.dg/pr30551-6.c +++ b/gcc/testsuite/gcc.dg/pr30551-6.c @@ -1,7 +1,7 @@ /* PR 30551 -Wmain is enabled by -pedantic. */ /* { dg-do compile } */ /* { dg-options "-pedantic" } */ - +/* { dg-skip-if "-Wmain not enabled with -pedantic on SPU" { spu-*-* } } */ void main(char a) {} /* { dg-warning "first argument of .main. should be .int." } */ /* { dg-warning ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */ /* { dg-warning "return type of .main. is not .int." "" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/gcc.dg/pr30551.c b/gcc/testsuite/gcc.dg/pr30551.c index d6fdd8fab46..218a50ad9c6 100644 --- a/gcc/testsuite/gcc.dg/pr30551.c +++ b/gcc/testsuite/gcc.dg/pr30551.c @@ -1,7 +1,7 @@ /* PR 30551 -Wmain is enabled by -Wall. */ /* { dg-do compile } */ /* { dg-options "-Wall" } */ - +/* { dg-skip-if "-Wmain not enabled with -Wall on SPU" { spu-*-* } } */ void main(char a) {} /* { dg-warning "first argument of .main. should be .int." } */ /* { dg-warning ".main. takes only zero or two arguments" "" { target *-*-* } 5 } */ /* { dg-warning "return type of .main. is not .int." "" { target *-*-* } 5 } */ diff --git a/gcc/testsuite/gcc.dg/visibility-14.c b/gcc/testsuite/gcc.dg/visibility-14.c new file mode 100644 index 00000000000..6b75608f2ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-14.c @@ -0,0 +1,9 @@ +/* Test that called external functions are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +int f () { + foo(); +} diff --git a/gcc/testsuite/gcc.dg/visibility-15.c b/gcc/testsuite/gcc.dg/visibility-15.c new file mode 100644 index 00000000000..4a3aa6803f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-15.c @@ -0,0 +1,11 @@ +/* Test that accessed external functions are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +typedef void (*foo_t)(void); + +foo_t g(void) { + return foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-16.c b/gcc/testsuite/gcc.dg/visibility-16.c new file mode 100644 index 00000000000..055d00f4856 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-16.c @@ -0,0 +1,9 @@ +/* Test that accessed external variables are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int f () { + return foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-17.c b/gcc/testsuite/gcc.dg/visibility-17.c new file mode 100644 index 00000000000..99a1bc276de --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-17.c @@ -0,0 +1,9 @@ +/* Test that external variable whose address is taken are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int *f () { + return &foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-18.c b/gcc/testsuite/gcc.dg/visibility-18.c new file mode 100644 index 00000000000..4e8706640ad --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-18.c @@ -0,0 +1,7 @@ +/* Test that external variable whose address is taken are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int *test = &foo; diff --git a/gcc/testsuite/gcc.dg/visibility-19.c b/gcc/testsuite/gcc.dg/visibility-19.c new file mode 100644 index 00000000000..f56f1360678 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-19.c @@ -0,0 +1,8 @@ +/* Test that accessed external functions are marked. */ +/* { dg-do compile } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +typedef void (*foo_t)(void); +foo_t test = foo; diff --git a/gcc/testsuite/gfortran.dg/argument_checking_7.f90 b/gcc/testsuite/gfortran.dg/argument_checking_7.f90 index 17f043a5a85..1c74fc58fd9 100644 --- a/gcc/testsuite/gfortran.dg/argument_checking_7.f90 +++ b/gcc/testsuite/gfortran.dg/argument_checking_7.f90 @@ -12,7 +12,7 @@ module cyclic character(len(y)-1) ouch integer i do i = 1, len(ouch) - ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error " PROCEDURE attribute conflicts" } + ouch(i:i) = achar(ieor(iachar(x(i:i)),iachar(y(i:i)))) ! { dg-error "Syntax error in argument list" } end do end function ouch end module cyclic diff --git a/gcc/testsuite/gfortran.dg/char_cshift_3.f90 b/gcc/testsuite/gfortran.dg/char_cshift_3.f90 new file mode 100644 index 00000000000..80c0ede3a27 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/char_cshift_3.f90 @@ -0,0 +1,13 @@ +! { dg-do run } +! PR 36886 - misalignment of characters for cshift could cause +! problems on some architectures. +program main + character(len=2) :: c2 + character(len=4), dimension(2,2) :: a, b, c, d + ! Force misalignment of a or b + common /foo/ a, c, c2, b, d + a = 'aa' + b = 'bb' + d = cshift(b,1) + c = cshift(a,1) +end program main diff --git a/gcc/testsuite/gfortran.dg/conflicts.f90 b/gcc/testsuite/gfortran.dg/conflicts.f90 index b1b59f4ac4c..1f10a65ceed 100644 --- a/gcc/testsuite/gfortran.dg/conflicts.f90 +++ b/gcc/testsuite/gfortran.dg/conflicts.f90 @@ -2,16 +2,16 @@ ! Check for conflicts ! PR fortran/29657 -function f1() ! { dg-error "has no IMPLICIT type" } +function f1() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } implicit none - real, save :: f1 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } + real, save :: f1 f1 = 1.0 end function f1 -function f2() +function f2() ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } implicit none real :: f2 - save f2 ! { dg-error "PROCEDURE attribute conflicts with SAVE attribute" } + save f2 f2 = 1.0 end function f2 diff --git a/gcc/testsuite/gfortran.dg/cshift_nan_1.f90 b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90 new file mode 100644 index 00000000000..896ecb3a4e1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/cshift_nan_1.f90 @@ -0,0 +1,24 @@ +! { dg-do run } +! Test cshift where the values are eight bytes, +! but are aligned on a four-byte boundary. The +! integers correspond to NaN values. +program main + implicit none + integer :: i + type t + sequence + integer :: a,b + end type t + type(t), dimension(4) :: u,v + common /foo/ u, i, v + + u(1)%a = 2142240768 + u(2)%a = 2144337920 + u(3)%a = -5242880 + u(4)%a = -3145728 + u%b = (/(i,i=-1,-4,-1)/) + v(1:3:2) = cshift(u(1:3:2),1) + v(2:4:2) = cshift(u(2:4:2),-1) + if (any(v%a /= (/-5242880, -3145728, 2142240768, 2144337920 /))) call abort + if (any(v%b /= (/-3, -4, -1, -2/))) call abort +end program main diff --git a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 index 3e7a3d18fb7..219722f7a2d 100644 --- a/gcc/testsuite/gfortran.dg/proc_decl_1.f90 +++ b/gcc/testsuite/gfortran.dg/proc_decl_1.f90 @@ -53,13 +53,13 @@ program prog contains - subroutine foo(a,c) + subroutine foo(a,c) ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" } abstract interface subroutine b() bind(C) end subroutine b end interface procedure(b), bind(c,name="hjj") :: a ! { dg-error "may not have BIND.C. attribute with NAME" } - procedure(c),intent(in):: c ! { dg-error "PROCEDURE attribute conflicts with INTENT attribute" } + procedure(b),intent(in):: c end subroutine foo end program diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_9.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_9.f90 new file mode 100644 index 00000000000..22708b8f1a8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_9.f90 @@ -0,0 +1,18 @@ +! { dg-do compile } +! +! PR fortran/36705 +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +save :: p +procedure() :: p +pointer :: p + +contains + +subroutine bar(x) + procedure(), intent(in) :: x + pointer :: x +end subroutine bar + +end diff --git a/gcc/testsuite/gfortran.dg/rank_1.f90 b/gcc/testsuite/gfortran.dg/rank_1.f90 index 3467faded2b..6a81e410bd5 100644 --- a/gcc/testsuite/gfortran.dg/rank_1.f90 +++ b/gcc/testsuite/gfortran.dg/rank_1.f90 @@ -4,6 +4,7 @@ ! Fortran < 2008 allows 7 dimensions ! Fortran 2008 allows 15 dimensions (including co-array ranks) ! -integer :: a(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) -integer :: b(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ! { dg-error "has more than 15 dimensions" } +! FIXME: Rank patch was reverted because of PR 36825. +integer :: a(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) ! { dg-error "has more than 7 dimensions" } +integer :: b(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ! { dg-error "has more than 7 dimensions" } end diff --git a/gcc/testsuite/gfortran.dg/utf8_1.f03 b/gcc/testsuite/gfortran.dg/utf8_1.f03 new file mode 100644 index 00000000000..6c30885cce5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/utf8_1.f03 @@ -0,0 +1,31 @@ +! { dg-do run } +! { dg-options "-fbackslash" } +! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org> +program test1 + implicit none + integer, parameter :: k4 = 4 + character(kind=4, len=30) :: string1, string2 + character(kind=1, len=30) :: string3 + string1 = k4_"This is Greek: \u039f\u03cd\u03c7\u03af" + string2 = k4_"Jerry in Japanese is: \u30b8\u30a8\u30ea\u30fc" + open(10, encoding="utf-8", status="scratch") + write(10,'(a)') trim(string1) + write(10,*) string2 + rewind(10) + string1 = k4_"" + string2 = k4_"" + string3 = "abcdefghijklmnopqrstuvwxyz" + read(10,'(a)') string1 + read(10,'(a)') string2 + if (string1 /= k4_"This is Greek: \u039f\u03cd\u03c7\u03af") call abort + if (len(trim(string1)) /= 20) call abort + if (string2 /= k4_" Jerry in Japanese is: \u30b8\u30a8\u30ea\u30fc")& + & call abort + if (len(string2) /= 30) call abort + rewind(10) + read(10,'(a)') string3 + if (string3 /= "This is Greek: ????") call abort +end program test1 +! The following examples require UTF-8 enabled editor to see correctly. +! ジエリー Sample of Japanese characters. +! Οá½Ï‡á½¶ Sample of Greek characters.
\ No newline at end of file diff --git a/gcc/testsuite/gfortran.dg/utf8_2.f03 b/gcc/testsuite/gfortran.dg/utf8_2.f03 new file mode 100644 index 00000000000..0146a2e281b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/utf8_2.f03 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-options "-fbackslash" } +! Contributed by Tobias Burnus +program test2 + integer,parameter :: ucs4 = selected_char_kind("iso_10646") + character(1,ucs4),parameter :: nen=char(int(z'5e74'),ucs4), & !year + gatsu=char(int(z'6708'),kind=ucs4), & !month + nichi=char(int(z'65e5'),kind=ucs4) !day + character(25,ucs4) :: string + open(10, encoding="utf-8", status="scratch") + write(10,1) 2008,nen,8,gatsu,10,nichi +1 format(i0,a,i0,a,i0,a) + rewind(10) + read(10,'(a)') string + if (string /= ucs4_"2008\u5e748\u670810\u65e5") call abort +end program test2 diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index ff8af4f14dd..2e34bd99d6b 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1976,6 +1976,7 @@ maybe_fold_offset_to_reference (tree base, tree offset, tree orig_type) &size, &maxsize); gcc_assert (newbase); if (size == maxsize + && size != -1 && !(sub_offset & (BITS_PER_UNIT - 1))) { base = newbase; diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 373b8da2a31..3e10c2e467d 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,58 @@ +2008-08-15 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libfortran/35863 + * intrinsics/selected_char_kind.c: Enable iso_10646. + * io/read.c (typedef uchar): New type. + (read_utf8): New function to read a single UTF-8 encoded character. + (read_utf8_char1): New function to read UTF-8 into a KIND=1 string. + (read_default_char1): New functio to read default into KIND=1 string. + (read_utf8_char4): New function to read UTF-8 into a KIND=4 string. + (read_default_char4): New function to read UTF-8 into a KIND=4 string. + (read_a): Modify to use the new functions. + (read_a_char4): Modify to use the new functions. + * io/write.c (error.h): Add include. (typedef uchar): New type. + (write_default_char4): New function to default write KIND=4 string. + (write_utf8_char4): New function to UTF-8 write KIND=4 string. + (write_a_char4): Modify to use new functions. + (write_character): Modify to use new functions. + +2008-08-14 H.J. Lu <hongjiu.lu@intel.com> + + PR libfortran/37123 + * intrinsics/cshift0.c (cshift0): Fix 2 typos. + +2008-08-14 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR libfortran/36886 + * Makefile.am: Added $(i_cshift0_c). + Added $(i_cshift0_c) to gfor_built_specific_src. + Add rule to build from cshift0.m4. + * Makefile.in: Regenerated. + * libgfortran.h: Addedd prototypes for cshift0_i1, + cshift0_i2, cshift0_i4, cshift0_i8, cshift0_i16, + cshift0_r4, cshift0_r8, cshift0_r10, cshift0_r16, + cshift0_c4, cshift0_c8, cshift0_c10, cshift0_c16. + Define Macros GFC_UNALIGNED_C4 and GFC_UNALIGNED_C8. + * intrinsics/cshift0.c: Remove helper functions for + the innter shift loop. + (cshift0): Call specific functions depending on type + of array argument. Only call specific functions for + correct alignment for other types. + * m4/cshift0.m4: New file. + * generated/cshift0_i1.c: New file. + * generated/cshift0_i2.c: New file. + * generated/cshift0_i4.c: New file. + * generated/cshift0_i8:.c New file. + * generated/cshift0_i16.c: New file. + * generated/cshift0_r4.c: New file. + * generated/cshift0_r8.c: New file. + * generated/cshift0_r10.c: New file. + * generated/cshift0_r16.c: New file. + * generated/cshift0_c4.c: New file. + * generated/cshift0_c8.c: New file. + * generated/cshift0_c10.c: New file. + * generated/cshift0_c16.c: New file. + 2008-07-27 Tobias Burnus <burnus@net-b.de> PR fortran/36132 diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am index 65a307af4bc..2223d61fcf2 100644 --- a/libgfortran/Makefile.am +++ b/libgfortran/Makefile.am @@ -379,6 +379,22 @@ $(srcdir)/generated/eoshift3_4.c \ $(srcdir)/generated/eoshift3_8.c \ $(srcdir)/generated/eoshift3_16.c +i_cshift0_c= \ +$(srcdir)/generated/cshift0_i1.c \ +$(srcdir)/generated/cshift0_i2.c \ +$(srcdir)/generated/cshift0_i4.c \ +$(srcdir)/generated/cshift0_i8.c \ +$(srcdir)/generated/cshift0_i16.c \ +$(srcdir)/generated/cshift0_r4.c \ +$(srcdir)/generated/cshift0_r8.c \ +$(srcdir)/generated/cshift0_r10.c \ +$(srcdir)/generated/cshift0_r16.c \ +$(srcdir)/generated/cshift0_c4.c \ +$(srcdir)/generated/cshift0_c8.c \ +$(srcdir)/generated/cshift0_c10.c \ +$(srcdir)/generated/cshift0_c16.c + + i_cshift1_c= \ $(srcdir)/generated/cshift1_4.c \ $(srcdir)/generated/cshift1_8.c \ @@ -545,7 +561,7 @@ gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ $(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \ $(i_pow_c) $(i_rrspacing_c) $(i_spacing_c) $(i_pack_c) $(i_unpack_c) \ $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \ - kinds.inc c99_protos.inc fpu-target.h + $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h # Machine generated specifics gfor_built_specific_src= \ @@ -829,6 +845,9 @@ $(i_eoshift1_c): m4/eoshift1.m4 $(I_M4_DEPS) $(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS) $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@ +$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS) + $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@ + $(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS) $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@ diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in index 594d22863c8..4f518301621 100644 --- a/libgfortran/Makefile.in +++ b/libgfortran/Makefile.in @@ -397,7 +397,20 @@ am__libgfortran_la_SOURCES_DIST = runtime/backtrace.c \ $(srcdir)/generated/spread_c8.c \ $(srcdir)/generated/spread_c10.c \ $(srcdir)/generated/spread_c16.c selected_int_kind.inc \ - selected_real_kind.inc kinds.h kinds.inc c99_protos.inc \ + selected_real_kind.inc kinds.h \ + $(srcdir)/generated/cshift0_i1.c \ + $(srcdir)/generated/cshift0_i2.c \ + $(srcdir)/generated/cshift0_i4.c \ + $(srcdir)/generated/cshift0_i8.c \ + $(srcdir)/generated/cshift0_i16.c \ + $(srcdir)/generated/cshift0_r4.c \ + $(srcdir)/generated/cshift0_r8.c \ + $(srcdir)/generated/cshift0_r10.c \ + $(srcdir)/generated/cshift0_r16.c \ + $(srcdir)/generated/cshift0_c4.c \ + $(srcdir)/generated/cshift0_c8.c \ + $(srcdir)/generated/cshift0_c10.c \ + $(srcdir)/generated/cshift0_c16.c kinds.inc c99_protos.inc \ fpu-target.h io/close.c io/file_pos.c io/format.c io/inquire.c \ io/intrinsics.c io/list_read.c io/lock.c io/open.c io/read.c \ io/size_from_kind.c io/transfer.c io/unit.c io/unix.c \ @@ -679,7 +692,11 @@ am__objects_32 = spread_i1.lo spread_i2.lo spread_i4.lo spread_i8.lo \ spread_i16.lo spread_r4.lo spread_r8.lo spread_r10.lo \ spread_r16.lo spread_c4.lo spread_c8.lo spread_c10.lo \ spread_c16.lo -am__objects_33 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \ +am__objects_33 = cshift0_i1.lo cshift0_i2.lo cshift0_i4.lo \ + cshift0_i8.lo cshift0_i16.lo cshift0_r4.lo cshift0_r8.lo \ + cshift0_r10.lo cshift0_r16.lo cshift0_c4.lo cshift0_c8.lo \ + cshift0_c10.lo cshift0_c16.lo +am__objects_34 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_5) $(am__objects_6) $(am__objects_7) \ $(am__objects_8) $(am__objects_9) $(am__objects_10) \ $(am__objects_11) $(am__objects_12) $(am__objects_13) \ @@ -689,11 +706,11 @@ am__objects_33 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \ $(am__objects_23) $(am__objects_24) $(am__objects_25) \ $(am__objects_26) $(am__objects_27) $(am__objects_28) \ $(am__objects_29) $(am__objects_30) $(am__objects_31) \ - $(am__objects_32) -am__objects_34 = close.lo file_pos.lo format.lo inquire.lo \ + $(am__objects_32) $(am__objects_33) +am__objects_35 = close.lo file_pos.lo format.lo inquire.lo \ intrinsics.lo list_read.lo lock.lo open.lo read.lo \ size_from_kind.lo transfer.lo unit.lo unix.lo write.lo fbuf.lo -am__objects_35 = associated.lo abort.lo access.lo args.lo \ +am__objects_36 = associated.lo abort.lo access.lo args.lo \ c99_functions.lo chdir.lo chmod.lo clock.lo cpu_time.lo \ cshift0.lo ctime.lo date_and_time.lo dtime.lo env.lo \ eoshift0.lo eoshift2.lo erfc_scaled.lo etime.lo exit.lo \ @@ -707,8 +724,8 @@ am__objects_35 = associated.lo abort.lo access.lo args.lo \ stat.lo symlnk.lo system_clock.lo time.lo transpose_generic.lo \ umask.lo unlink.lo unpack_generic.lo in_pack_generic.lo \ in_unpack_generic.lo -am__objects_36 = -am__objects_37 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \ +am__objects_37 = +am__objects_38 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \ _abs_i4.lo _abs_i8.lo _abs_i16.lo _abs_r4.lo _abs_r8.lo \ _abs_r10.lo _abs_r16.lo _aimag_c4.lo _aimag_c8.lo \ _aimag_c10.lo _aimag_c16.lo _exp_r4.lo _exp_r8.lo _exp_r10.lo \ @@ -732,18 +749,18 @@ am__objects_37 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \ _conjg_c4.lo _conjg_c8.lo _conjg_c10.lo _conjg_c16.lo \ _aint_r4.lo _aint_r8.lo _aint_r10.lo _aint_r16.lo _anint_r4.lo \ _anint_r8.lo _anint_r10.lo _anint_r16.lo -am__objects_38 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \ +am__objects_39 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \ _sign_r8.lo _sign_r10.lo _sign_r16.lo _dim_i4.lo _dim_i8.lo \ _dim_i16.lo _dim_r4.lo _dim_r8.lo _dim_r10.lo _dim_r16.lo \ _atan2_r4.lo _atan2_r8.lo _atan2_r10.lo _atan2_r16.lo \ _mod_i4.lo _mod_i8.lo _mod_i16.lo _mod_r4.lo _mod_r8.lo \ _mod_r10.lo _mod_r16.lo -am__objects_39 = misc_specifics.lo -am__objects_40 = $(am__objects_37) $(am__objects_38) $(am__objects_39) \ +am__objects_40 = misc_specifics.lo +am__objects_41 = $(am__objects_38) $(am__objects_39) $(am__objects_40) \ dprod_r8.lo f2c_specifics.lo -am__objects_41 = $(am__objects_1) $(am__objects_33) $(am__objects_34) \ - $(am__objects_35) $(am__objects_36) $(am__objects_40) -@onestep_FALSE@am_libgfortran_la_OBJECTS = $(am__objects_41) +am__objects_42 = $(am__objects_1) $(am__objects_34) $(am__objects_35) \ + $(am__objects_36) $(am__objects_37) $(am__objects_41) +@onestep_FALSE@am_libgfortran_la_OBJECTS = $(am__objects_42) @onestep_TRUE@am_libgfortran_la_OBJECTS = libgfortran_c.lo libgfortran_la_OBJECTS = $(am_libgfortran_la_OBJECTS) libgfortranbegin_la_LIBADD = @@ -1279,6 +1296,21 @@ $(srcdir)/generated/eoshift3_4.c \ $(srcdir)/generated/eoshift3_8.c \ $(srcdir)/generated/eoshift3_16.c +i_cshift0_c = \ +$(srcdir)/generated/cshift0_i1.c \ +$(srcdir)/generated/cshift0_i2.c \ +$(srcdir)/generated/cshift0_i4.c \ +$(srcdir)/generated/cshift0_i8.c \ +$(srcdir)/generated/cshift0_i16.c \ +$(srcdir)/generated/cshift0_r4.c \ +$(srcdir)/generated/cshift0_r8.c \ +$(srcdir)/generated/cshift0_r10.c \ +$(srcdir)/generated/cshift0_r16.c \ +$(srcdir)/generated/cshift0_c4.c \ +$(srcdir)/generated/cshift0_c8.c \ +$(srcdir)/generated/cshift0_c10.c \ +$(srcdir)/generated/cshift0_c16.c + i_cshift1_c = \ $(srcdir)/generated/cshift1_4.c \ $(srcdir)/generated/cshift1_8.c \ @@ -1445,7 +1477,7 @@ gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \ $(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \ $(i_pow_c) $(i_rrspacing_c) $(i_spacing_c) $(i_pack_c) $(i_unpack_c) \ $(i_spread_c) selected_int_kind.inc selected_real_kind.inc kinds.h \ - kinds.inc c99_protos.inc fpu-target.h + $(i_cshift0_c) kinds.inc c99_protos.inc fpu-target.h # Machine generated specifics @@ -1771,6 +1803,19 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/count_8_l.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu_time.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c10.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c16.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_c8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i16.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_i8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r10.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r16.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r4.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift0_r8.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_16.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_4.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cshift1_8.Plo@am__quote@ @@ -5038,6 +5083,97 @@ spread_c16.lo: $(srcdir)/generated/spread_c16.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o spread_c16.lo `test -f '$(srcdir)/generated/spread_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/spread_c16.c +cshift0_i1.lo: $(srcdir)/generated/cshift0_i1.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i1.lo -MD -MP -MF "$(DEPDIR)/cshift0_i1.Tpo" -c -o cshift0_i1.lo `test -f '$(srcdir)/generated/cshift0_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i1.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i1.Tpo" "$(DEPDIR)/cshift0_i1.Plo"; else rm -f "$(DEPDIR)/cshift0_i1.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i1.c' object='cshift0_i1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i1.lo `test -f '$(srcdir)/generated/cshift0_i1.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i1.c + +cshift0_i2.lo: $(srcdir)/generated/cshift0_i2.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i2.lo -MD -MP -MF "$(DEPDIR)/cshift0_i2.Tpo" -c -o cshift0_i2.lo `test -f '$(srcdir)/generated/cshift0_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i2.Tpo" "$(DEPDIR)/cshift0_i2.Plo"; else rm -f "$(DEPDIR)/cshift0_i2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i2.c' object='cshift0_i2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i2.lo `test -f '$(srcdir)/generated/cshift0_i2.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i2.c + +cshift0_i4.lo: $(srcdir)/generated/cshift0_i4.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i4.lo -MD -MP -MF "$(DEPDIR)/cshift0_i4.Tpo" -c -o cshift0_i4.lo `test -f '$(srcdir)/generated/cshift0_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i4.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i4.Tpo" "$(DEPDIR)/cshift0_i4.Plo"; else rm -f "$(DEPDIR)/cshift0_i4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i4.c' object='cshift0_i4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i4.lo `test -f '$(srcdir)/generated/cshift0_i4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i4.c + +cshift0_i8.lo: $(srcdir)/generated/cshift0_i8.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i8.lo -MD -MP -MF "$(DEPDIR)/cshift0_i8.Tpo" -c -o cshift0_i8.lo `test -f '$(srcdir)/generated/cshift0_i8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i8.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i8.Tpo" "$(DEPDIR)/cshift0_i8.Plo"; else rm -f "$(DEPDIR)/cshift0_i8.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i8.c' object='cshift0_i8.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i8.lo `test -f '$(srcdir)/generated/cshift0_i8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i8.c + +cshift0_i16.lo: $(srcdir)/generated/cshift0_i16.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_i16.lo -MD -MP -MF "$(DEPDIR)/cshift0_i16.Tpo" -c -o cshift0_i16.lo `test -f '$(srcdir)/generated/cshift0_i16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i16.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_i16.Tpo" "$(DEPDIR)/cshift0_i16.Plo"; else rm -f "$(DEPDIR)/cshift0_i16.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_i16.c' object='cshift0_i16.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_i16.lo `test -f '$(srcdir)/generated/cshift0_i16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_i16.c + +cshift0_r4.lo: $(srcdir)/generated/cshift0_r4.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r4.lo -MD -MP -MF "$(DEPDIR)/cshift0_r4.Tpo" -c -o cshift0_r4.lo `test -f '$(srcdir)/generated/cshift0_r4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r4.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r4.Tpo" "$(DEPDIR)/cshift0_r4.Plo"; else rm -f "$(DEPDIR)/cshift0_r4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r4.c' object='cshift0_r4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r4.lo `test -f '$(srcdir)/generated/cshift0_r4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r4.c + +cshift0_r8.lo: $(srcdir)/generated/cshift0_r8.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r8.lo -MD -MP -MF "$(DEPDIR)/cshift0_r8.Tpo" -c -o cshift0_r8.lo `test -f '$(srcdir)/generated/cshift0_r8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r8.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r8.Tpo" "$(DEPDIR)/cshift0_r8.Plo"; else rm -f "$(DEPDIR)/cshift0_r8.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r8.c' object='cshift0_r8.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r8.lo `test -f '$(srcdir)/generated/cshift0_r8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r8.c + +cshift0_r10.lo: $(srcdir)/generated/cshift0_r10.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r10.lo -MD -MP -MF "$(DEPDIR)/cshift0_r10.Tpo" -c -o cshift0_r10.lo `test -f '$(srcdir)/generated/cshift0_r10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r10.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r10.Tpo" "$(DEPDIR)/cshift0_r10.Plo"; else rm -f "$(DEPDIR)/cshift0_r10.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r10.c' object='cshift0_r10.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r10.lo `test -f '$(srcdir)/generated/cshift0_r10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r10.c + +cshift0_r16.lo: $(srcdir)/generated/cshift0_r16.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_r16.lo -MD -MP -MF "$(DEPDIR)/cshift0_r16.Tpo" -c -o cshift0_r16.lo `test -f '$(srcdir)/generated/cshift0_r16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r16.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_r16.Tpo" "$(DEPDIR)/cshift0_r16.Plo"; else rm -f "$(DEPDIR)/cshift0_r16.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_r16.c' object='cshift0_r16.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_r16.lo `test -f '$(srcdir)/generated/cshift0_r16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_r16.c + +cshift0_c4.lo: $(srcdir)/generated/cshift0_c4.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c4.lo -MD -MP -MF "$(DEPDIR)/cshift0_c4.Tpo" -c -o cshift0_c4.lo `test -f '$(srcdir)/generated/cshift0_c4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c4.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c4.Tpo" "$(DEPDIR)/cshift0_c4.Plo"; else rm -f "$(DEPDIR)/cshift0_c4.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c4.c' object='cshift0_c4.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c4.lo `test -f '$(srcdir)/generated/cshift0_c4.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c4.c + +cshift0_c8.lo: $(srcdir)/generated/cshift0_c8.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c8.lo -MD -MP -MF "$(DEPDIR)/cshift0_c8.Tpo" -c -o cshift0_c8.lo `test -f '$(srcdir)/generated/cshift0_c8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c8.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c8.Tpo" "$(DEPDIR)/cshift0_c8.Plo"; else rm -f "$(DEPDIR)/cshift0_c8.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c8.c' object='cshift0_c8.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c8.lo `test -f '$(srcdir)/generated/cshift0_c8.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c8.c + +cshift0_c10.lo: $(srcdir)/generated/cshift0_c10.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c10.lo -MD -MP -MF "$(DEPDIR)/cshift0_c10.Tpo" -c -o cshift0_c10.lo `test -f '$(srcdir)/generated/cshift0_c10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c10.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c10.Tpo" "$(DEPDIR)/cshift0_c10.Plo"; else rm -f "$(DEPDIR)/cshift0_c10.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c10.c' object='cshift0_c10.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c10.lo `test -f '$(srcdir)/generated/cshift0_c10.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c10.c + +cshift0_c16.lo: $(srcdir)/generated/cshift0_c16.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cshift0_c16.lo -MD -MP -MF "$(DEPDIR)/cshift0_c16.Tpo" -c -o cshift0_c16.lo `test -f '$(srcdir)/generated/cshift0_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c16.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/cshift0_c16.Tpo" "$(DEPDIR)/cshift0_c16.Plo"; else rm -f "$(DEPDIR)/cshift0_c16.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/generated/cshift0_c16.c' object='cshift0_c16.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift0_c16.lo `test -f '$(srcdir)/generated/cshift0_c16.c' || echo '$(srcdir)/'`$(srcdir)/generated/cshift0_c16.c + close.lo: io/close.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT close.lo -MD -MP -MF "$(DEPDIR)/close.Tpo" -c -o close.lo `test -f 'io/close.c' || echo '$(srcdir)/'`io/close.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/close.Tpo" "$(DEPDIR)/close.Plo"; else rm -f "$(DEPDIR)/close.Tpo"; exit 1; fi @@ -5973,6 +6109,9 @@ fpu-target.h: $(srcdir)/$(FPU_HOST_HEADER) @MAINTAINER_MODE_TRUE@$(i_eoshift3_c): m4/eoshift3.m4 $(I_M4_DEPS) @MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 eoshift3.m4 > $@ +@MAINTAINER_MODE_TRUE@$(i_cshift0_c): m4/cshift0.m4 $(I_M4_DEPS) +@MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift0.m4 > $@ + @MAINTAINER_MODE_TRUE@$(i_cshift1_c): m4/cshift1.m4 $(I_M4_DEPS) @MAINTAINER_MODE_TRUE@ $(M4) -Dfile=$@ -I$(srcdir)/m4 cshift1.m4 > $@ diff --git a/libgfortran/generated/cshift0_c10.c b/libgfortran/generated/cshift0_c10.c new file mode 100644 index 00000000000..9f0997044d2 --- /dev/null +++ b/libgfortran/generated/cshift0_c10.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_COMPLEX_10) + +void +cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_COMPLEX_10 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_COMPLEX_10 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_COMPLEX_10); + size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_10); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_COMPLEX_10 *dest = rptr; + const GFC_COMPLEX_10 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_c16.c b/libgfortran/generated/cshift0_c16.c new file mode 100644 index 00000000000..deabe262937 --- /dev/null +++ b/libgfortran/generated/cshift0_c16.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_COMPLEX_16) + +void +cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_COMPLEX_16 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_COMPLEX_16 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_COMPLEX_16); + size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_16); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_COMPLEX_16 *dest = rptr; + const GFC_COMPLEX_16 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_c4.c b/libgfortran/generated/cshift0_c4.c new file mode 100644 index 00000000000..462169f9a26 --- /dev/null +++ b/libgfortran/generated/cshift0_c4.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_COMPLEX_4) + +void +cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_COMPLEX_4 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_COMPLEX_4 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_COMPLEX_4); + size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_4); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_COMPLEX_4 *dest = rptr; + const GFC_COMPLEX_4 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_c8.c b/libgfortran/generated/cshift0_c8.c new file mode 100644 index 00000000000..0653e1d3f0d --- /dev/null +++ b/libgfortran/generated/cshift0_c8.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_COMPLEX_8) + +void +cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_COMPLEX_8 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_COMPLEX_8 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_COMPLEX_8); + size_t len2 = (len - shift) * sizeof (GFC_COMPLEX_8); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_COMPLEX_8 *dest = rptr; + const GFC_COMPLEX_8 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_i1.c b/libgfortran/generated/cshift0_i1.c new file mode 100644 index 00000000000..c21d75ebe5e --- /dev/null +++ b/libgfortran/generated/cshift0_i1.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_INTEGER_1) + +void +cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_INTEGER_1 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_INTEGER_1 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_INTEGER_1); + size_t len2 = (len - shift) * sizeof (GFC_INTEGER_1); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_INTEGER_1 *dest = rptr; + const GFC_INTEGER_1 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_i16.c b/libgfortran/generated/cshift0_i16.c new file mode 100644 index 00000000000..e2c88f461af --- /dev/null +++ b/libgfortran/generated/cshift0_i16.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_INTEGER_16) + +void +cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_INTEGER_16 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_INTEGER_16 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_INTEGER_16); + size_t len2 = (len - shift) * sizeof (GFC_INTEGER_16); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_INTEGER_16 *dest = rptr; + const GFC_INTEGER_16 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_i2.c b/libgfortran/generated/cshift0_i2.c new file mode 100644 index 00000000000..ec2ea1d8b6b --- /dev/null +++ b/libgfortran/generated/cshift0_i2.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_INTEGER_2) + +void +cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_INTEGER_2 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_INTEGER_2 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_INTEGER_2); + size_t len2 = (len - shift) * sizeof (GFC_INTEGER_2); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_INTEGER_2 *dest = rptr; + const GFC_INTEGER_2 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_i4.c b/libgfortran/generated/cshift0_i4.c new file mode 100644 index 00000000000..c2dc7b83764 --- /dev/null +++ b/libgfortran/generated/cshift0_i4.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_INTEGER_4) + +void +cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_INTEGER_4 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_INTEGER_4 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_INTEGER_4); + size_t len2 = (len - shift) * sizeof (GFC_INTEGER_4); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_INTEGER_4 *dest = rptr; + const GFC_INTEGER_4 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_i8.c b/libgfortran/generated/cshift0_i8.c new file mode 100644 index 00000000000..b4e38659172 --- /dev/null +++ b/libgfortran/generated/cshift0_i8.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_INTEGER_8) + +void +cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_INTEGER_8 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_INTEGER_8 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_INTEGER_8); + size_t len2 = (len - shift) * sizeof (GFC_INTEGER_8); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_INTEGER_8 *dest = rptr; + const GFC_INTEGER_8 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_r10.c b/libgfortran/generated/cshift0_r10.c new file mode 100644 index 00000000000..1eb9169e93a --- /dev/null +++ b/libgfortran/generated/cshift0_r10.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_REAL_10) + +void +cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_REAL_10 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_REAL_10 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_REAL_10); + size_t len2 = (len - shift) * sizeof (GFC_REAL_10); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_REAL_10 *dest = rptr; + const GFC_REAL_10 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_r16.c b/libgfortran/generated/cshift0_r16.c new file mode 100644 index 00000000000..c4e229bdaa7 --- /dev/null +++ b/libgfortran/generated/cshift0_r16.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_REAL_16) + +void +cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_REAL_16 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_REAL_16 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_REAL_16); + size_t len2 = (len - shift) * sizeof (GFC_REAL_16); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_REAL_16 *dest = rptr; + const GFC_REAL_16 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_r4.c b/libgfortran/generated/cshift0_r4.c new file mode 100644 index 00000000000..112ff97e5d3 --- /dev/null +++ b/libgfortran/generated/cshift0_r4.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_REAL_4) + +void +cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_REAL_4 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_REAL_4 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_REAL_4); + size_t len2 = (len - shift) * sizeof (GFC_REAL_4); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_REAL_4 *dest = rptr; + const GFC_REAL_4 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/generated/cshift0_r8.c b/libgfortran/generated/cshift0_r8.c new file mode 100644 index 00000000000..a167fd3306a --- /dev/null +++ b/libgfortran/generated/cshift0_r8.c @@ -0,0 +1,176 @@ +/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h> + + +#if defined (HAVE_GFC_REAL_8) + +void +cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + GFC_REAL_8 *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const GFC_REAL_8 *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof (GFC_REAL_8); + size_t len2 = (len - shift) * sizeof (GFC_REAL_8); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + GFC_REAL_8 *dest = rptr; + const GFC_REAL_8 *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c index ac26e86cf5f..73849d1a44f 100644 --- a/libgfortran/intrinsics/cshift0.c +++ b/libgfortran/intrinsics/cshift0.c @@ -33,48 +33,6 @@ Boston, MA 02110-1301, USA. */ #include <assert.h> #include <string.h> - -/* "Templatized" helper function for the inner shift loop. */ - -#define DEF_COPY_LOOP(NAME, TYPE) \ -static inline void \ -copy_loop_##NAME (void *xdest, const void *xsrc, \ - size_t roff, size_t soff, \ - index_type len, index_type shift) \ -{ \ - TYPE *dest = xdest; \ - const TYPE *src; \ - index_type i; \ - \ - roff /= sizeof (TYPE); \ - soff /= sizeof (TYPE); \ - \ - src = xsrc; \ - src += shift * soff; \ - for (i = 0; i < len - shift; ++i) \ - { \ - *dest = *src; \ - dest += roff; \ - src += soff; \ - } \ - \ - src = xsrc; \ - for (i = 0; i < shift; ++i) \ - { \ - *dest = *src; \ - dest += roff; \ - src += soff; \ - } \ -} - -DEF_COPY_LOOP(int, int) -DEF_COPY_LOOP(long, long) -DEF_COPY_LOOP(double, double) -DEF_COPY_LOOP(ldouble, long double) -DEF_COPY_LOOP(cfloat, _Complex float) -DEF_COPY_LOOP(cdouble, _Complex double) - - static void cshift0 (gfc_array_char * ret, const gfc_array_char * array, ssize_t shift, int which, index_type size) @@ -96,9 +54,10 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, index_type dim; index_type len; index_type n; - int whichloop; index_type arraysize; + index_type type_size; + if (which < 1 || which > GFC_DESCRIPTOR_RANK (array)) runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'"); @@ -133,43 +92,188 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, if (arraysize == 0) return; + type_size = GFC_DTYPE_TYPE_SIZE (array); - which = which - 1; - sstride[0] = 0; - rstride[0] = 0; + switch(type_size) + { + case GFC_DTYPE_LOGICAL_1: + case GFC_DTYPE_INTEGER_1: + case GFC_DTYPE_DERIVED_1: + cshift0_i1 ((gfc_array_i1 *)ret, (gfc_array_i1 *) array, shift, which); + return; + + case GFC_DTYPE_LOGICAL_2: + case GFC_DTYPE_INTEGER_2: + cshift0_i2 ((gfc_array_i2 *)ret, (gfc_array_i2 *) array, shift, which); + return; + + case GFC_DTYPE_LOGICAL_4: + case GFC_DTYPE_INTEGER_4: + cshift0_i4 ((gfc_array_i4 *)ret, (gfc_array_i4 *) array, shift, which); + return; + + case GFC_DTYPE_LOGICAL_8: + case GFC_DTYPE_INTEGER_8: + cshift0_i8 ((gfc_array_i8 *)ret, (gfc_array_i8 *) array, shift, which); + return; - extent[0] = 1; - count[0] = 0; - n = 0; +#ifdef HAVE_GFC_INTEGER_16 + case GFC_DTYPE_LOGICAL_16: + case GFC_DTYPE_INTEGER_16: + cshift0_i16 ((gfc_array_i16 *)ret, (gfc_array_i16 *) array, shift, + which); + return; +#endif - /* The values assigned here must match the cases in the inner loop. */ - whichloop = 0; - switch (GFC_DESCRIPTOR_TYPE (array)) - { - case GFC_DTYPE_LOGICAL: - case GFC_DTYPE_INTEGER: - case GFC_DTYPE_REAL: - if (size == sizeof (int)) - whichloop = 1; - else if (size == sizeof (long)) - whichloop = 2; - else if (size == sizeof (double)) - whichloop = 3; - else if (size == sizeof (long double)) - whichloop = 4; + case GFC_DTYPE_REAL_4: + cshift0_r4 ((gfc_array_r4 *)ret, (gfc_array_r4 *) array, shift, which); + return; + + case GFC_DTYPE_REAL_8: + cshift0_r8 ((gfc_array_r8 *)ret, (gfc_array_r8 *) array, shift, which); + return; + +#ifdef HAVE_GFC_REAL_10 + case GFC_DTYPE_REAL_10: + cshift0_r10 ((gfc_array_r10 *)ret, (gfc_array_r10 *) array, shift, + which); + return; +#endif + +#ifdef HAVE_GFC_REAL_16 + case GFC_DTYPE_REAL_16: + cshift0_r16 ((gfc_array_r16 *)ret, (gfc_array_r16 *) array, shift, + which); + return; +#endif + + case GFC_DTYPE_COMPLEX_4: + cshift0_c4 ((gfc_array_c4 *)ret, (gfc_array_c4 *) array, shift, which); + return; + + case GFC_DTYPE_COMPLEX_8: + cshift0_c8 ((gfc_array_c8 *)ret, (gfc_array_c8 *) array, shift, which); + return; + +#ifdef HAVE_GFC_COMPLEX_10 + case GFC_DTYPE_COMPLEX_10: + cshift0_c10 ((gfc_array_c10 *)ret, (gfc_array_c10 *) array, shift, + which); + return; +#endif + +#ifdef HAVE_GFC_COMPLEX_16 + case GFC_DTYPE_COMPLEX_16: + cshift0_c16 ((gfc_array_c16 *)ret, (gfc_array_c16 *) array, shift, + which); + return; +#endif + + default: break; + } - case GFC_DTYPE_COMPLEX: - if (size == sizeof (_Complex float)) - whichloop = 5; - else if (size == sizeof (_Complex double)) - whichloop = 6; + switch (size) + { + /* Let's check the actual alignment of the data pointers. If they + are suitably aligned, we can safely call the unpack functions. */ + + case sizeof (GFC_INTEGER_1): + cshift0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array, shift, + which); break; + case sizeof (GFC_INTEGER_2): + if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(array->data)) + break; + else + { + cshift0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array, shift, + which); + return; + } + + case sizeof (GFC_INTEGER_4): + if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(array->data)) + break; + else + { + cshift0_i4 ((gfc_array_i4 *)ret, (gfc_array_i4 *) array, shift, + which); + return; + } + + case sizeof (GFC_INTEGER_8): + if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(array->data)) + { + /* Let's try to use the complex routines. First, a sanity + check that the sizes match; this should be optimized to + a no-op. */ + if (sizeof(GFC_INTEGER_8) != sizeof(GFC_COMPLEX_4)) + break; + + if (GFC_UNALIGNED_C4(ret->data) || GFC_UNALIGNED_C4(array->data)) + break; + + cshift0_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array, shift, + which); + return; + } + else + { + cshift0_i8 ((gfc_array_i8 *)ret, (gfc_array_i8 *) array, shift, + which); + return; + } + +#ifdef HAVE_GFC_INTEGER_16 + case sizeof (GFC_INTEGER_16): + if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(array->data)) + { + /* Let's try to use the complex routines. First, a sanity + check that the sizes match; this should be optimized to + a no-op. */ + if (sizeof(GFC_INTEGER_16) != sizeof(GFC_COMPLEX_8)) + break; + + if (GFC_UNALIGNED_C8(ret->data) || GFC_UNALIGNED_C8(array->data)) + break; + + cshift0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, shift, + which); + return; + } + else + { + cshift0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array, + shift, which); + return; + } +#else + case sizeof (GFC_COMPLEX_8): + + if (GFC_UNALIGNED_C8(ret->data) || GFC_UNALIGNED_C8(array->data)) + break; + else + { + cshift0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array, shift, + which); + return; + } +#endif + default: break; } + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; /* Initialized for avoiding compiler warnings. */ roffset = size; soffset = size; @@ -227,56 +331,21 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array, else { /* Otherwise, we'll have to perform the copy one element at - a time. We can speed this up a tad for common cases of - fundamental types. */ - switch (whichloop) + a time. */ + char *dest = rptr; + const char *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + memcpy (dest, src, size); + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) { - case 0: - { - char *dest = rptr; - const char *src = &sptr[shift * soffset]; - - for (n = 0; n < len - shift; n++) - { - memcpy (dest, src, size); - dest += roffset; - src += soffset; - } - for (src = sptr, n = 0; n < shift; n++) - { - memcpy (dest, src, size); - dest += roffset; - src += soffset; - } - } - break; - - case 1: - copy_loop_int (rptr, sptr, roffset, soffset, len, shift); - break; - - case 2: - copy_loop_long (rptr, sptr, roffset, soffset, len, shift); - break; - - case 3: - copy_loop_double (rptr, sptr, roffset, soffset, len, shift); - break; - - case 4: - copy_loop_ldouble (rptr, sptr, roffset, soffset, len, shift); - break; - - case 5: - copy_loop_cfloat (rptr, sptr, roffset, soffset, len, shift); - break; - - case 6: - copy_loop_cdouble (rptr, sptr, roffset, soffset, len, shift); - break; - - default: - abort (); + memcpy (dest, src, size); + dest += roffset; + src += soffset; } } diff --git a/libgfortran/intrinsics/selected_char_kind.c b/libgfortran/intrinsics/selected_char_kind.c index c10d5b2efaf..686636198b2 100644 --- a/libgfortran/intrinsics/selected_char_kind.c +++ b/libgfortran/intrinsics/selected_char_kind.c @@ -44,6 +44,8 @@ selected_char_kind (gfc_charlen_type name_len, char *name) if ((len == 5 && strncasecmp (name, "ascii", 5) == 0) || (len == 7 && strncasecmp (name, "default", 7) == 0)) return 1; + else if (len == 9 && strncasecmp (name, "iso_10646", 9) == 0) + return 1; else return -1; } diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index cb88933bf97..8d25493b2fa 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA. */ #include <ctype.h> #include <stdlib.h> +typedef unsigned char uchar; + /* read.c -- Deal with formatted reads */ @@ -236,78 +238,239 @@ read_l (st_parameter_dt *dtp, const fnode *f, char *dest, int length) } -/* read_a()-- Read a character record. This one is pretty easy. */ - -void -read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length) +static inline gfc_char4_t +read_utf8 (st_parameter_dt *dtp, size_t *nbytes) { + static const uchar masks[6] = { 0x7F, 0x1F, 0x0F, 0x07, 0x02, 0x01 }; + static const uchar patns[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + static uchar buffer[6]; + size_t i, nb, nread; + gfc_char4_t c; + int status; char *s; - int m, n, wi, status; - size_t w; - wi = f->u.w; - if (wi == -1) /* '(A)' edit descriptor */ - wi = length; + *nbytes = 1; + s = (char *) &buffer[0]; + status = read_block_form (dtp, s, nbytes); + if (status == FAILURE) + return 0; - w = wi; + /* If this is a short read, just return. */ + if (*nbytes == 0) + return 0; - s = gfc_alloca (w); + c = buffer[0]; + if (c < 0x80) + return c; - dtp->u.p.sf_read_comma = 0; - status = read_block_form (dtp, s, &w); - dtp->u.p.sf_read_comma = - dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; + /* The number of leading 1-bits in the first byte indicates how many + bytes follow. */ + for (nb = 2; nb < 7; nb++) + if ((c & ~masks[nb-1]) == patns[nb-1]) + goto found; + goto invalid; + + found: + c = (c & masks[nb-1]); + nread = nb - 1; + + s = (char *) &buffer[1]; + status = read_block_form (dtp, s, &nread); + if (status == FAILURE) + return 0; + /* Decode the bytes read. */ + for (i = 1; i < nb; i++) + { + gfc_char4_t n = *s++; + + if ((n & 0xC0) != 0x80) + goto invalid; + + c = ((c << 6) + (n & 0x3F)); + } + + /* Make sure the shortest possible encoding was used. */ + if (c <= 0x7F && nb > 1) goto invalid; + if (c <= 0x7FF && nb > 2) goto invalid; + if (c <= 0xFFFF && nb > 3) goto invalid; + if (c <= 0x1FFFFF && nb > 4) goto invalid; + if (c <= 0x3FFFFFF && nb > 5) goto invalid; + + /* Make sure the character is valid. */ + if (c > 0x7FFFFFFF || (c >= 0xD800 && c <= 0xDFFF)) + goto invalid; + + return c; + + invalid: + generate_error (&dtp->common, LIBERROR_READ_VALUE, "Invalid UTF-8 encoding"); + return (gfc_char4_t) '?'; +} + + +static void +read_utf8_char1 (st_parameter_dt *dtp, char *p, int len, size_t width) +{ + gfc_char4_t c; + char *dest; + size_t nbytes; + int i, j; + + len = ((int) width < len) ? len : (int) width; + + dest = (char *) p; + + /* Proceed with decoding one character at a time. */ + for (j = 0; j < len; j++, dest++) + { + c = read_utf8 (dtp, &nbytes); + + /* Check for a short read and if so, break out. */ + if (nbytes == 0) + break; + + *dest = c > 255 ? '?' : (uchar) c; + } + + /* If there was a short read, pad the remaining characters. */ + for (i = j; i < len; i++) + *dest++ = ' '; + return; +} + +static void +read_default_char1 (st_parameter_dt *dtp, char *p, int len, size_t width) +{ + char *s; + int m, n, status; + + s = gfc_alloca (width); + + status = read_block_form (dtp, s, &width); + if (status == FAILURE) return; - if (w > (size_t) length) - s += (w - length); + if (width > (size_t) len) + s += (width - len); - m = ((int) w > length) ? length : (int) w; + m = ((int) width > len) ? len : (int) width; memcpy (p, s, m); - n = length - w; + n = len - width; if (n > 0) memset (p + m, ' ', n); } -void -read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length) + +static void +read_utf8_char4 (st_parameter_dt *dtp, void *p, int len, size_t width) { - char *s; gfc_char4_t *dest; - int m, n, wi, status; - size_t w; + size_t nbytes; + int i, j; - wi = f->u.w; - if (wi == -1) /* '(A)' edit descriptor */ - wi = length; + len = ((int) width < len) ? len : (int) width; - w = wi; + dest = (gfc_char4_t *) p; - s = gfc_alloca (w); + /* Proceed with decoding one character at a time. */ + for (j = 0; j < len; j++, dest++) + { + *dest = read_utf8 (dtp, &nbytes); - /* Read in w bytes, treating comma as not a separator. */ - dtp->u.p.sf_read_comma = 0; - status = read_block_form (dtp, s, &w); - dtp->u.p.sf_read_comma = - dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; + /* Check for a short read and if so, break out. */ + if (nbytes == 0) + break; + } + + /* If there was a short read, pad the remaining characters. */ + for (i = j; i < len; i++) + *dest++ = (gfc_char4_t) ' '; + return; +} + + +static void +read_default_char4 (st_parameter_dt *dtp, char *p, int len, size_t width) +{ + char *s; + gfc_char4_t *dest; + int m, n, status; + + s = gfc_alloca (width); + + status = read_block_form (dtp, s, &width); if (status == FAILURE) return; - if (w > (size_t) length) - s += (w - length); + if (width > (size_t) len) + s += (width - len); - m = ((int) w > length) ? length : (int) w; + m = ((int) width > len) ? len : (int) width; dest = (gfc_char4_t *) p; for (n = 0; n < m; n++, dest++, s++) *dest = (unsigned char ) *s; - for (n = 0; n < length - (int) w; n++, dest++) + for (n = 0; n < len - (int) width; n++, dest++) *dest = (unsigned char) ' '; } + +/* read_a()-- Read a character record into a KIND=1 character destination, + processing UTF-8 encoding if necessary. */ + +void +read_a (st_parameter_dt *dtp, const fnode *f, char *p, int length) +{ + int wi; + size_t w; + + wi = f->u.w; + if (wi == -1) /* '(A)' edit descriptor */ + wi = length; + w = wi; + + /* Read in w characters, treating comma as not a separator. */ + dtp->u.p.sf_read_comma = 0; + + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + read_utf8_char1 (dtp, p, length, w); + else + read_default_char1 (dtp, p, length, w); + + dtp->u.p.sf_read_comma = + dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; +} + + +/* read_a_char4()-- Read a character record into a KIND=4 character destination, + processing UTF-8 encoding if necessary. */ + +void +read_a_char4 (st_parameter_dt *dtp, const fnode *f, char *p, int length) +{ + int wi; + size_t w; + + wi = f->u.w; + if (wi == -1) /* '(A)' edit descriptor */ + wi = length; + w = wi; + + /* Read in w characters, treating comma as not a separator. */ + dtp->u.p.sf_read_comma = 0; + + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + read_utf8_char4 (dtp, p, length, w); + else + read_default_char4 (dtp, p, length, w); + + dtp->u.p.sf_read_comma = + dtp->u.p.decimal_status == DECIMAL_COMMA ? 0 : 1; +} + /* eat_leading_spaces()-- Given a character pointer and a width, * ignore the leading spaces. */ diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index ed50e0d5705..8194cf8b719 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -36,10 +36,161 @@ Boston, MA 02110-1301, USA. */ #include <ctype.h> #include <stdlib.h> #include <stdbool.h> +#include <errno.h> #define star_fill(p, n) memset(p, '*', n) #include "write_float.def" +typedef unsigned char uchar; + +/* Write out default char4. */ + +static void +write_default_char4 (st_parameter_dt *dtp, gfc_char4_t *source, + int src_len, int w_len) +{ + char *p; + int j, k = 0; + gfc_char4_t c; + uchar d; + + /* Take care of preceding blanks. */ + if (w_len > src_len) + { + k = w_len - src_len; + p = write_block (dtp, k); + if (p == NULL) + return; + memset (p, ' ', k); + } + + /* Get ready to handle delimiters if needed. */ + + switch (dtp->u.p.delim_status) + { + case DELIM_APOSTROPHE: + d = '\''; + break; + case DELIM_QUOTE: + d = '"'; + break; + default: + d = ' '; + break; + } + + /* Now process the remaining characters, one at a time. */ + for (j = k; j < src_len; j++) + { + c = source[j]; + + /* Handle delimiters if any. */ + if (c == d && d != ' ') + { + p = write_block (dtp, 2); + if (p == NULL) + return; + *p++ = (uchar) c; + } + else + { + p = write_block (dtp, 1); + if (p == NULL) + return; + } + *p = c > 255 ? '?' : (uchar) c; + } +} + + +/* Write out UTF-8 converted from char4. */ + +static void +write_utf8_char4 (st_parameter_dt *dtp, gfc_char4_t *source, + int src_len, int w_len) +{ + char *p; + int j, k = 0; + gfc_char4_t c; + static const uchar masks[6] = { 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + static const uchar limits[6] = { 0x80, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE }; + size_t nbytes; + uchar buf[6], d, *q; + + /* Take care of preceding blanks. */ + if (w_len > src_len) + { + k = w_len - src_len; + p = write_block (dtp, k); + if (p == NULL) + return; + memset (p, ' ', k); + } + + /* Get ready to handle delimiters if needed. */ + + switch (dtp->u.p.delim_status) + { + case DELIM_APOSTROPHE: + d = '\''; + break; + case DELIM_QUOTE: + d = '"'; + break; + default: + d = ' '; + break; + } + + /* Now process the remaining characters, one at a time. */ + for (j = k; j < src_len; j++) + { + c = source[j]; + if (c < 0x80) + { + /* Handle the delimiters if any. */ + if (c == d && d != ' ') + { + p = write_block (dtp, 2); + if (p == NULL) + return; + *p++ = (uchar) c; + } + else + { + p = write_block (dtp, 1); + if (p == NULL) + return; + } + *p = (uchar) c; + } + else + { + /* Convert to UTF-8 sequence. */ + nbytes = 1; + q = &buf[6]; + + do + { + *--q = ((c & 0x3F) | 0x80); + c >>= 6; + nbytes++; + } + while (c >= 0x3F || (c & limits[nbytes-1])); + + *--q = (c | masks[nbytes-1]); + + p = write_block (dtp, nbytes); + if (p == NULL) + return; + + while (q < &buf[6]) + *p++ = *q++; + } + } +} + + void write_a (st_parameter_dt *dtp, const fnode *f, const char *source, int len) { @@ -126,17 +277,16 @@ write_a (st_parameter_dt *dtp, const fnode *f, const char *source, int len) /* The primary difference between write_a_char4 and write_a is that we have to - deal with writing from the first byte of the 4-byte character and take care - of endianess. This currently implements encoding="default" which means we - write the lowest significant byte. If the 3 most significant bytes are - not representable emit a '?'. TODO: Implement encoding="UTF-8" - which will process all 4 bytes and translate to the encoded output. */ + deal with writing from the first byte of the 4-byte character and pay + attention to the most significant bytes. For ENCODING="default" write the + lowest significant byte. If the 3 most significant bytes contain + non-zero values, emit a '?'. For ENCODING="utf-8", convert the UCS-32 value + to the UTF-8 encoded string before writing out. */ void write_a_char4 (st_parameter_dt *dtp, const fnode *f, const char *source, int len) { int wlen; - char *p; gfc_char4_t *q; wlen = f->u.string.length < 0 @@ -173,19 +323,15 @@ write_a_char4 (st_parameter_dt *dtp, const fnode *f, const char *source, int len /* Write out the previously scanned characters in the string. */ if (bytes > 0) { - p = write_block (dtp, bytes); - if (p == NULL) - return; - for (j = 0; j < bytes; j++) - p[j] = q[j] > 255 ? '?' : (unsigned char) q[j]; + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + write_utf8_char4 (dtp, q, bytes, 0); + else + write_default_char4 (dtp, q, bytes, 0); bytes = 0; } /* Write out the CR_LF sequence. */ - p = write_block (dtp, 2); - if (p == NULL) - return; - memcpy (p, crlf, 2); + write_default_char4 (dtp, crlf, 2, 0); } else bytes++; @@ -194,32 +340,19 @@ write_a_char4 (st_parameter_dt *dtp, const fnode *f, const char *source, int len /* Write out any remaining bytes if no LF was found. */ if (bytes > 0) { - p = write_block (dtp, bytes); - if (p == NULL) - return; - for (j = 0; j < bytes; j++) - p[j] = q[j] > 255 ? '?' : (unsigned char) q[j]; + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + write_utf8_char4 (dtp, q, bytes, 0); + else + write_default_char4 (dtp, q, bytes, 0); } } else { #endif - int j; - p = write_block (dtp, wlen); - if (p == NULL) - return; - - if (wlen < len) - { - for (j = 0; j < wlen; j++) - p[j] = q[j] > 255 ? '?' : (unsigned char) q[j]; - } + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + write_utf8_char4 (dtp, q, len, wlen); else - { - memset (p, ' ', wlen - len); - for (j = wlen - len; j < wlen; j++) - p[j] = q[j] > 255 ? '?' : (unsigned char) q[j]; - } + write_default_char4 (dtp, q, len, wlen); #ifdef HAVE_CRLF } #endif @@ -745,8 +878,6 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length) { int i, extra; char *p, d; - gfc_char4_t *q; - switch (dtp->u.p.delim_status) { @@ -769,9 +900,9 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length) { extra = 2; - for (i = 0; i < length; i++) - if (source[i] == d) - extra++; + for (i = 0; i < length; i++) + if (source[i] == d) + extra++; } p = write_block (dtp, length + extra); @@ -796,40 +927,24 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length) } else { - /* We have to scan the source string looking for delimiters to determine - how large the write block needs to be. */ if (d == ' ') - extra = 0; - else { - extra = 2; - - q = (gfc_char4_t *) source; - for (i = 0; i < length; i++, q++) - if (*q == (gfc_char4_t) d) - extra++; - } - - p = write_block (dtp, length + extra); - if (p == NULL) - return; - - if (d == ' ') - { - q = (gfc_char4_t *) source; - for (i = 0; i < length; i++, q++) - p[i] = *q > 255 ? '?' : (unsigned char) *q; + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + write_utf8_char4 (dtp, (gfc_char4_t *) source, length, 0); + else + write_default_char4 (dtp, (gfc_char4_t *) source, length, 0); } else { - *p++ = d; - q = (gfc_char4_t *) source; - for (i = 0; i < length; i++, q++) - { - *p++ = *q > 255 ? '?' : (unsigned char) *q; - if (*q == (gfc_char4_t) d) - *p++ = d; - } + p = write_block (dtp, 1); + *p = d; + + if (dtp->u.p.current_unit->flags.encoding == ENCODING_UTF8) + write_utf8_char4 (dtp, (gfc_char4_t *) source, length, 0); + else + write_default_char4 (dtp, (gfc_char4_t *) source, length, 0); + + p = write_block (dtp, 1); *p = d; } } diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 7c497004a81..a055483e4ce 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -437,6 +437,12 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16; (__alignof__(GFC_INTEGER_16) - 1)) #endif +#define GFC_UNALIGNED_C4(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_COMPLEX_4) - 1)) + +#define GFC_UNALIGNED_C8(x) (((uintptr_t)(x)) & \ + (__alignof__(GFC_COMPLEX_8) - 1)) + /* Runtime library include. */ #define stringize(x) expand_macro(x) #define expand_macro(x) # x @@ -1210,4 +1216,55 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t; extern index_type size0 (const array_t * array); iexport_proto(size0); +/* Internal auxiliary functions for cshift */ + +void cshift0_i1 (gfc_array_i1 *, const gfc_array_i1 *, ssize_t, int); +internal_proto(cshift0_i1); + +void cshift0_i2 (gfc_array_i2 *, const gfc_array_i2 *, ssize_t, int); +internal_proto(cshift0_i2); + +void cshift0_i4 (gfc_array_i4 *, const gfc_array_i4 *, ssize_t, int); +internal_proto(cshift0_i4); + +void cshift0_i8 (gfc_array_i8 *, const gfc_array_i8 *, ssize_t, int); +internal_proto(cshift0_i8); + +#ifdef HAVE_GFC_INTEGER_16 +void cshift0_i16 (gfc_array_i16 *, const gfc_array_i16 *, ssize_t, int); +internal_proto(cshift0_i16); +#endif + +void cshift0_r4 (gfc_array_r4 *, const gfc_array_r4 *, ssize_t, int); +internal_proto(cshift0_r4); + +void cshift0_r8 (gfc_array_r8 *, const gfc_array_r8 *, ssize_t, int); +internal_proto(cshift0_r8); + +#ifdef HAVE_GFC_REAL_10 +void cshift0_r10 (gfc_array_r10 *, const gfc_array_r10 *, ssize_t, int); +internal_proto(cshift0_r10); +#endif + +#ifdef HAVE_GFC_REAL_16 +void cshift0_r16 (gfc_array_r16 *, const gfc_array_r16 *, ssize_t, int); +internal_proto(cshift0_r16); +#endif + +void cshift0_c4 (gfc_array_c4 *, const gfc_array_c4 *, ssize_t, int); +internal_proto(cshift0_c4); + +void cshift0_c8 (gfc_array_c8 *, const gfc_array_c8 *, ssize_t, int); +internal_proto(cshift0_c8); + +#ifdef HAVE_GFC_COMPLEX_10 +void cshift0_c10 (gfc_array_c10 *, const gfc_array_c10 *, ssize_t, int); +internal_proto(cshift0_c10); +#endif + +#ifdef HAVE_GFC_COMPLEX_16 +void cshift0_c16 (gfc_array_c16 *, const gfc_array_c16 *, ssize_t, int); +internal_proto(cshift0_c16); +#endif + #endif /* LIBGFOR_H */ diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4 new file mode 100644 index 00000000000..b633169ae51 --- /dev/null +++ b/libgfortran/m4/cshift0.m4 @@ -0,0 +1,177 @@ +`/* Helper function for cshift functions. + Copyright 2008 Free Software Foundation, Inc. + Contributed by Thomas Koenig <tkoenig@gcc.gnu.org> + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +Libgfortran 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 libgfortran; see the file COPYING. If not, +write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "libgfortran.h" +#include <stdlib.h> +#include <assert.h> +#include <string.h>' + +include(iparm.m4)dnl + +`#if defined (HAVE_'rtype_name`) + +void +cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ssize_t shift, + int which) +{ + /* r.* indicates the return array. */ + index_type rstride[GFC_MAX_DIMENSIONS]; + index_type rstride0; + index_type roffset; + 'rtype_name` *rptr; + + /* s.* indicates the source array. */ + index_type sstride[GFC_MAX_DIMENSIONS]; + index_type sstride0; + index_type soffset; + const 'rtype_name` *sptr; + + index_type count[GFC_MAX_DIMENSIONS]; + index_type extent[GFC_MAX_DIMENSIONS]; + index_type dim; + index_type len; + index_type n; + + which = which - 1; + sstride[0] = 0; + rstride[0] = 0; + + extent[0] = 1; + count[0] = 0; + n = 0; + /* Initialized for avoiding compiler warnings. */ + roffset = 1; + soffset = 1; + len = 0; + + for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) + { + if (dim == which) + { + roffset = ret->dim[dim].stride; + if (roffset == 0) + roffset = 1; + soffset = array->dim[dim].stride; + if (soffset == 0) + soffset = 1; + len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + } + else + { + count[n] = 0; + extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + rstride[n] = ret->dim[dim].stride; + sstride[n] = array->dim[dim].stride; + n++; + } + } + if (sstride[0] == 0) + sstride[0] = 1; + if (rstride[0] == 0) + rstride[0] = 1; + + dim = GFC_DESCRIPTOR_RANK (array); + rstride0 = rstride[0]; + sstride0 = sstride[0]; + rptr = ret->data; + sptr = array->data; + + shift = len == 0 ? 0 : shift % (ssize_t)len; + if (shift < 0) + shift += len; + + while (rptr) + { + /* Do the shift for this dimension. */ + + /* If elements are contiguous, perform the operation + in two block moves. */ + if (soffset == 1 && roffset == 1) + { + size_t len1 = shift * sizeof ('rtype_name`); + size_t len2 = (len - shift) * sizeof ('rtype_name`); + memcpy (rptr, sptr + shift, len2); + memcpy (rptr + (len - shift), sptr, len1); + } + else + { + /* Otherwise, we will have to perform the copy one element at + a time. */ + 'rtype_name` *dest = rptr; + const 'rtype_name` *src = &sptr[shift * soffset]; + + for (n = 0; n < len - shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + for (src = sptr, n = 0; n < shift; n++) + { + *dest = *src; + dest += roffset; + src += soffset; + } + } + + /* Advance to the next section. */ + rptr += rstride0; + sptr += sstride0; + count[0]++; + n = 0; + while (count[n] == extent[n]) + { + /* When we get to the end of a dimension, reset it and increment + the next dimension. */ + count[n] = 0; + /* We could precalculate these products, but this is a less + frequently used path so probably not worth it. */ + rptr -= rstride[n] * extent[n]; + sptr -= sstride[n] * extent[n]; + n++; + if (n >= dim - 1) + { + /* Break out of the loop. */ + rptr = NULL; + break; + } + else + { + count[n]++; + rptr += rstride[n]; + sptr += sstride[n]; + } + } + } + + return; +} + +#endif' |