re PR target/14262 (Structure size computed wrong)
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 11 Mar 2004 22:53:52 +0000 (22:53 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Thu, 11 Mar 2004 22:53:52 +0000 (22:53 +0000)
PR target/14262
* calls.c (load_register_parameters): If BLOCK_REG_PADDING is not
defined, pass small BLKmode values in registers in the low-order part.

* gcc.dg/20040305-2.c: New test.

From-SVN: r79348

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20040305-2.c [new file with mode: 0644]

index 8526cfb6c88314fdb66692cab320abe7fa9203ce..66813dd26c1f948b08e3a1ab067cb5ac9687c954 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-11  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR target/14262
+       * calls.c (load_register_parameters): If BLOCK_REG_PADDING is not
+       defined, pass small BLKmode values in registers in the low-order part.
+
 2004-03-11  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * combine.c (if_then_else_cond): Check for NULL return value of
index 4bfcde4f6e1bb8d5aa6f783c48cedcbd46553c48..29c06aa47723241ec98f22997a2bc9684b5194a2 100644 (file)
@@ -1675,10 +1675,14 @@ load_register_parameters (struct arg_data *args, int num_actuals,
            {
              rtx mem = validize_mem (args[i].value);
 
-#ifdef BLOCK_REG_PADDING
              /* Handle a BLKmode that needs shifting.  */
              if (nregs == 1 && size < UNITS_PER_WORD
-                 && args[i].locate.where_pad == downward)
+#ifdef BLOCK_REG_PADDING
+                 && args[i].locate.where_pad == downward
+#else
+                 && BYTES_BIG_ENDIAN
+#endif
+                )
                {
                  rtx tem = operand_subword_force (mem, 0, args[i].mode);
                  rtx ri = gen_rtx_REG (word_mode, REGNO (reg));
@@ -1693,7 +1697,6 @@ load_register_parameters (struct arg_data *args, int num_actuals,
                    emit_move_insn (ri, x);
                }
              else
-#endif
                move_block_to_reg (REGNO (reg), mem, nregs, args[i].mode);
            }
 
index da07a0408e901a5f6544c1ce9237edcc076e4294..fe5bb99a066cd72d5ff28315fcb58bcfdc6eab6b 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-11  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       PR target/14262
+       * gcc.dg/20040305-2.c: New test.
+
 2004-03-11  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * gcc.dg/20040310-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/20040305-2.c b/gcc/testsuite/gcc.dg/20040305-2.c
new file mode 100644 (file)
index 0000000..4a3ef9a
--- /dev/null
@@ -0,0 +1,45 @@
+/* PR target/14262 */
+/* { dg-do run } */
+
+typedef char   ACS;
+typedef char   LSM;
+typedef char   PANEL;
+typedef char   DRIVE;
+typedef struct {
+    ACS             acs;
+    LSM             lsm;
+} LSMID;
+typedef struct {
+    LSMID           lsm_id;
+    PANEL           panel;
+} PANELID;
+typedef struct {
+    PANELID         panel_id;
+    DRIVE           drive;
+} DRIVEID;
+
+void sub (DRIVEID driveid)
+{
+  if (driveid.drive != 1)
+    abort ();
+  if (driveid.panel_id.panel != 2)
+    abort ();
+  if (driveid.panel_id.lsm_id.lsm != 3)
+    abort ();
+  if (driveid.panel_id.lsm_id.acs != 4)
+    abort ();
+}
+
+int main(void)
+{
+  DRIVEID driveid;
+
+  driveid.drive = 1;
+  driveid.panel_id.panel = 2;
+  driveid.panel_id.lsm_id.lsm = 3;
+  driveid.panel_id.lsm_id.acs = 4;
+
+  sub(driveid);
+}
+
+