[PATCH] moxie: enable LRA

2023-03-03 Thread Anthony Green


Committed as obviously correct.  Enable LRA for the moxie port.

gcc/ChangeLog:

* config/moxie/moxie.cc (TARGET_LRA_P): Remove.


diff --git a/gcc/config/moxie/moxie.cc b/gcc/config/moxie/moxie.cc
index dcf87ef98a1..2132b6e48a3 100644
--- a/gcc/config/moxie/moxie.cc
+++ b/gcc/config/moxie/moxie.cc
@@ -616,9 +616,6 @@ moxie_legitimate_address_p (machine_mode mode 
ATTRIBUTE_UNUSED,
 #undef  TARGET_FUNCTION_ARG_ADVANCE
 #define TARGET_FUNCTION_ARG_ADVANCEmoxie_function_arg_advance
 
-#undef TARGET_LRA_P
-#define TARGET_LRA_P hook_bool_void_false
-
 #undef  TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
 #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P moxie_legitimate_address_p


[PATCH] moxie: use define_memory_constraint

2023-03-03 Thread Anthony Green


Committed as obviously correct.  Required to make LRA for moxie work.

gcc/ChangeLog:

* config/moxie/constraints.md (A, B, W): Change
define_constraint to define_memory_constraint.


diff --git a/gcc/config/moxie/constraints.md b/gcc/config/moxie/constraints.md
index 16c64b28b59..78e8e9813fd 100644
--- a/gcc/config/moxie/constraints.md
+++ b/gcc/config/moxie/constraints.md
@@ -22,19 +22,19 @@
 ;; Constraints
 ;; -
 
-(define_constraint "A"
+(define_memory_constraint "A"
   "An absolute address."
   (and (match_code "mem")
(ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
(match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
(match_test "GET_CODE (XEXP (op, 0)) == CONST"
 
-(define_constraint "B"
+(define_memory_constraint "B"
   "An offset address."
   (and (match_code "mem")
(match_test "moxie_offset_address_p (op)")))
 
-(define_constraint "W"
+(define_memory_constraint "W"
   "A register indirect memory operand."
   (and (match_code "mem")
(match_test "REG_P (XEXP (op, 0))


Re: Broken build

2020-05-27 Thread Anthony Green
Hans-Peter Nilsson via Gcc-patches  writes:

> And here's an improper bug report.
>
> One of the commits between cfdff3eeb90..5c8344e7289 caused every
> single *linked* test to fail for cris-elf, like:

I can confirm that the moxie-elf test cases don't link either.

It looks like setting ldscript in the board description file doesn't
work.  In my case that means "-Tsim.ld" isn't being passed through and
we can't link anymore.  Here's moxie-sim.exp:

https://github.com/moxielogic/moxie-test-gcc/blob/7c707e187f101922e3ef7f6e23dbbd1890f9e8dd/moxie-sim.exp#L42

Thanks for looking, Alex.

AG



[PATCH, moxie] Adjust divide-by-zero testcase for moxie

2018-10-14 Thread Anthony Green


This patch adjusts one of the c-torture tests to account for the
possible lack of divide-by-zero exceptions on certain moxie targets.

Committed.


gcc/testsuite/

2018-10-14  Anthony Green  

* gcc.c-torture/execute/20101011-1.c: Adjust for moxie.


Index: gcc/testsuite/gcc.c-torture/execute/20101011-1.c
===
--- gcc/testsuite/gcc.c-torture/execute/20101011-1.c(revision 265146)
+++ gcc/testsuite/gcc.c-torture/execute/20101011-1.c(working copy)
@@ -97,6 +97,9 @@
   /* This presently doesn't raise SIGFPE even on csky-linux-gnu, much
  less bare metal.  See the implementation of __divsi3 in libgcc.  */
 # define DO_TEST 0
+#elif defined (__moxie__)
+  /* Not all moxie configurations may raise exceptions.  */
+# define DO_TEST 0
 #else
 # define DO_TEST 1
 #endif


[PATCH, moxie] Fix endianness issue for moxiebox configuration

2016-03-22 Thread Anthony Green
Hello,

The attached patch fixes an endianness issue for the moxiebox
configuration of the moxie target.  I've just committed it.

Thanks,

AG


2016-03-22  Anthony Green  <gr...@moxielogic.com>

* config/moxie/moxiebox.h (CC1_SPEC): Define.  Fix endianness
issue for moxiebox targets.
(CC1PLUS_SPEC): Ditto.



Index: gcc/config/moxie/moxiebox.h
===
--- gcc/config/moxie/moxiebox.h(revision 234061)
+++ gcc/config/moxie/moxiebox.h(working copy)
@@ -39,6 +39,12 @@
 #undef  ASM_SPEC
 #define ASM_SPEC "-EL"

+#undef CC1_SPEC
+#define CC1_SPEC "-mel %{meb:%ethis target is little-endian}"
+
+#undef CC1PLUS_SPEC
+#define CC1PLUS_SPEC CC1_SPEC
+
 #undef MULTILIB_DEFAULTS

 #undef SIZE_TYPE


Re: Housekeeping work in backends.html

2015-01-13 Thread Anthony Green
Eric Botcazou ebotca...@adacore.com writes:

 Some ports are missing (lm32, moxie, nios2, nvptx, rl78, rx) so the relevant 
 maintainers are CCed (see 6.3.9 Anatomy of a Target Back End in the doc).

I think I got this right

   |  Characteristics
Target | HMSLQNFICBD lqrcpfgmbdiates
---+
moxie  |   F   g  ds


AG


[PATCH, moxie] Fix mul.x availability on moxieboix

2015-01-10 Thread Anthony Green

I'm committing this patch which correctly forces a flag on instead of
off.

AG


2015-01-10  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.c (moxie_option_override): Fix forcing of
mul.x availability for moxiebox configuration.

Index: gcc/config/moxie/moxie.c
===
--- gcc/config/moxie/moxie.c(revision 219421)
+++ gcc/config/moxie/moxie.c(working copy)
@@ -262,7 +262,7 @@
   init_machine_status = moxie_init_machine_status;
 
 #ifdef TARGET_MOXIEBOX  
-  target_flags = ~MASK_HAS_MULX;
+  target_flags |= MASK_HAS_MULX;
 #endif
 }
 


[PATCH, moxie] Fix CC_REG definition

2015-01-09 Thread Anthony Green

The moxie port had CC_REG referring to a real hard register ($r9) by
mistake instead of the virtual CC register.  This never resulted in
incorrect code, but we would often see $r9 marked as used in a function
when it actually wasn't.  I'm checking this in.

2015-01-09  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md (CC_REG): Correct register definition.


Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219418)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -367,7 +367,7 @@
 ;; -
 
 (define_constants
-  [(CC_REG 11)])
+  [(CC_REG 19)])
 
 (define_expand cbranchsi4
   [(set (reg:CC CC_REG)


[PATCH, moxie] Tabify assembly output

2015-01-09 Thread Anthony Green

I'm committing the following patch, which cleans up the assembly output
by using tabs between opcodes and operands.

Thanks,

AG

 2015-01-09  Anthony Green  gr...@moxielogic.com
 
* config/moxie/moxie.md: Tabify assembly output.


Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219420)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -48,9 +48,9 @@
   (match_operand:SI 2 moxie_add_operand I,N,r)))]
   
   @
-  inc%0, %2
-  dec   %0, -%2
-  add%0, %2)
+  inc\\t%0, %2
+  dec\\t%0, -%2
+  add\\t%0, %2)
 
 (define_insn subsi3
   [(set (match_operand:SI 0 register_operand =r,r)
@@ -59,8 +59,8 @@
   (match_operand:SI 2 moxie_sub_operand I,r)))]
   
   @
-  dec%0, %2
-  sub%0, %2)
+  dec\\t%0, %2
+  sub\\t%0, %2)
 
 (define_insn mulsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -68,7 +68,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mul%0, %2)
+  mul\\t%0, %2)
 
 (define_code_iterator EXTEND [sign_extend zero_extend])
 (define_code_attr mul [(sign_extend mul) (zero_extend umul)])
@@ -105,7 +105,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  div%0, %2)
+  div\\t%0, %2)
 
 (define_insn udivsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -113,7 +113,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  udiv   %0, %2)
+  udiv\\t%0, %2)
 
 (define_insn modsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -121,7 +121,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mod%0, %2)
+  mod\\t%0, %2)
 
 (define_insn umodsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -129,7 +129,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  umod   %0, %2)
+  umod\\t%0, %2)
 
 ;; -
 ;; Unary arithmetic instructions
@@ -139,13 +139,13 @@
   [(set (match_operand:SI 0 register_operand =r)
  (neg:SI (match_operand:SI 1 register_operand r)))]
   
-  neg%0, %1)
+  neg\\t%0, %1)
 
 (define_insn one_cmplsi2
   [(set (match_operand:SI 0 register_operand =r)
(not:SI (match_operand:SI 1 register_operand r)))]
   
-  not%0, %1)
+  not\\t%0, %1)
 
 ;; -
 ;; Logical operators
@@ -157,7 +157,7 @@
(match_operand:SI 2 register_operand r)))]
   
 {
-  return and%0, %2;
+  return and\\t%0, %2;
 })
 
 (define_insn xorsi3
@@ -166,7 +166,7 @@
(match_operand:SI 2 register_operand r)))]
   
 {
-  return xor%0, %2;
+  return xor\\t%0, %2;
 })
 
 (define_insn iorsi3
@@ -175,7 +175,7 @@
(match_operand:SI 2 register_operand r)))]
   
 {
-  return or %0, %2;
+  return or\\t%0, %2;
 })
 
 ;; -
@@ -188,7 +188,7 @@
   (match_operand:SI 2 register_operand r)))]
   
 {
-  return ashl   %0, %2;
+  return ashl\\t%0, %2;
 })
 
 (define_insn ashrsi3
@@ -197,7 +197,7 @@
 (match_operand:SI 2 register_operand r)))]
   
 {
-  return ashr   %0, %2;
+  return ashr\\t%0, %2;
 })
 
 (define_insn lshrsi3
@@ -206,7 +206,7 @@
 (match_operand:SI 2 register_operand r)))]
   
 {
-  return lshr   %0, %2;
+  return lshr\\t%0, %2;
 })
 
 ;; -
@@ -220,14 +220,14 @@
   [(set (mem:SI (pre_dec:SI (reg:SI 1)))
(match_operand:SI 0 register_operand r))]
   
-  push   $sp, %0)
+  push\\t$sp, %0)
 
 ;; Pop a register from the stack
 (define_insn movsi_pop
   [(set (match_operand:SI 1 register_operand =r)
(mem:SI (post_inc:SI (match_operand:SI 0 register_operand r]
   
-  pop%0, %1)
+  pop\\t%0, %1)
 
 (define_expand movsi
[(set (match_operand:SI 0 general_operand )
@@ -257,15 +257,15 @@
   register_operand (operands[0], SImode)
|| register_operand (operands[1], SImode)
   @
-   xor%0, %0
-   mov%0, %1
-   ldi.l  %0, %1
-   st.l   %0, %1
-   sta.l  %0, %1
-   ld.l   %0, %1
-   lda.l  %0, %1
-   sto.l  %0, %1
-   ldo.l  %0, %1
+   xor\\t%0, %0
+   mov\\t%0, %1
+   ldi.l\\t%0, %1
+   st.l\\t%0, %1
+   sta.l\\t%0, %1
+   ld.l\\t%0, %1
+   lda.l\\t%0, %1
+   sto.l\\t%0, %1
+   ldo.l\\t%0, %1
   [(set_attr length  2,2,6,2,6,2,6,4,4)])
 
 (define_insn zero_extendqisi2
@@ -273,10 +273,10 @@
(zero_extend:SI (match_operand:QI 1 nonimmediate_operand r,W,A,B)))]
   
   @
-   zex.b  %0, %1
-   ld.b   %0, %1
-   lda.b  %0, %1
-   ldo.b  %0, %1
+   zex.b\\t%0, %1
+   ld.b\\t%0, %1
+   lda.b\\t%0, %1
+   ldo.b\\t%0, %1
   [(set_attr

[PATCH, moxie] Restrict offsets for ldo/sto to 16 bits

2015-01-01 Thread Anthony Green

Happy new year!

I'm checking in this patch, which ensures that offsets for register
offset addressing on moxie are limited to 16 bits.

Since this is the first commit of 2015, I'm rolling the ChangeLog file
as well.

Thanks,

AG


2015-01-01  Anthony Green  gr...@moxielogic.com

* config/moxie/predicates.md (moxie_general_movsrc_operand):
Restrict move source register offsets to 16 bits.


Index: config/moxie/predicates.md
===
--- config/moxie/predicates.md  (revision 219135)
+++ config/moxie/predicates.md  (working copy)
@@ -34,7 +34,8 @@
   if (MEM_P (op)
GET_CODE (XEXP (op, 0)) == PLUS
GET_CODE (XEXP (XEXP (op, 0), 0)) == REG
-   GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)
+   GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT
+   IN_RANGE (INTVAL (XEXP (XEXP (op, 0), 1)), -32768, 32767))
 return 1;
 
   return general_operand (op, mode);


[PATCH, moxie] Eliminate redundant zero extension instructions

2014-12-30 Thread Anthony Green

I've checked in the attached patch.  The moxie port was emitting
redundant (harmless) zero extend (zex) instructions.  This fixes that.

AG


2014-12-30  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md (zero_extendqisi2, zero_extendhisi2):
Switch from define_insn_and_split to define_insn.  Fix instruction
length.


Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219114)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -268,7 +268,7 @@
ldo.l  %0, %1
   [(set_attr length  2,2,6,2,6,2,6,4,4)])
 
-(define_insn_and_split zero_extendqisi2
+(define_insn zero_extendqisi2
   [(set (match_operand:SI 0 register_operand =r,r,r,r)
(zero_extend:SI (match_operand:QI 1 nonimmediate_operand r,W,A,B)))]
   
@@ -277,15 +277,9 @@
ld.b   %0, %1
lda.b  %0, %1
ldo.b  %0, %1
-  reload_completed
-  [(set (match_dup 2) (match_dup 1))
-   (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
-{
-  operands[2] = gen_lowpart (QImode, operands[0]);
-}
-  [(set_attr length 2,2,6,6)])
+  [(set_attr length 2,2,6,4)])
 
-(define_insn_and_split zero_extendhisi2
+(define_insn zero_extendhisi2
   [(set (match_operand:SI 0 register_operand =r,r,r,r)
(zero_extend:SI (match_operand:HI 1 nonimmediate_operand r,W,A,B)))]
   
@@ -294,13 +288,7 @@
ld.s   %0, %1
lda.s  %0, %1
ldo.s  %0, %1
-  reload_completed
-  [(set (match_dup 2) (match_dup 1))
-   (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
-{
-  operands[2] = gen_lowpart (HImode, operands[0]);
-}
-  [(set_attr length 2,2,6,6)])
+  [(set_attr length 2,2,6,4)])
 
 (define_insn extendqisi2
   [(set (match_operand:SI 0 register_operand =r)


[PATCH, moxie] Limit moxie sto/ldo offsets to 16-bits.

2014-12-27 Thread Anthony Green

I'm checking in the attached patch to switch ldo/sto offsets to 16 bits
from 32.  This was a long overdue backwards incompatible change to the
ISA.


2014-12-27  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie-protos.h (moxie_offset_address_p): Define.
* config/moxie/constraints.md (B): Replace inline test with call
to moxie_offset_address_p.
* config/moxie/moxie.h (GO_IF_LEGITIMATE_ADDRESS): Limit offset
addressing to 16-bit offsets.
* config/moxie/moxie.c (moxie_asm_trampoline_template): Remove
nop, which is no longer needed for aligned write to trampoline.
(moxie_trampoline_init): Adjust for smaller trampoline.
(moxie_offset_address_p): New function.
* config/moxie/moxie.md (*movsi, *movhi, *movqi): Adjust length
attr for shorter ldo/sto instructions.
* config/moxie/predicates.md: Only allow REG+CONST_INT for offset
load/stores.


Index: gcc/config/moxie/constraints.md
===
--- gcc/config/moxie/constraints.md (revision 219054)
+++ gcc/config/moxie/constraints.md (working copy)
@@ -32,7 +32,7 @@
 (define_constraint B
   An offset address.
   (and (match_code mem)
-   (match_test GET_CODE (XEXP (op, 0)) == PLUS)))
+   (match_test moxie_offset_address_p (op
 
 (define_constraint W
   A register indirect memory operand.
Index: gcc/config/moxie/moxie-protos.h
===
--- gcc/config/moxie/moxie-protos.h (revision 219054)
+++ gcc/config/moxie/moxie-protos.h (working copy)
@@ -22,3 +22,6 @@
 extern int   moxie_initial_elimination_offset (int, int);
 extern void  moxie_print_operand (FILE *, rtx, int);
 extern void  moxie_print_operand_address (FILE *, rtx);
+extern bool  moxie_offset_address_p (rtx);
+
+
Index: gcc/config/moxie/moxie.c
===
--- gcc/config/moxie/moxie.c(revision 219056)
+++ gcc/config/moxie/moxie.c(working copy)
@@ -555,7 +555,6 @@
   fprintf (f, \tldi.l $r0, 0x0\n);
   fprintf (f, \tsto.l 0x8($fp), $r0\n);
   fprintf (f, \tpop   $sp, $r0\n);
-  fprintf (f, \tnop\n);
   fprintf (f, \tjmpa  0x0\n);
 }
 
@@ -571,10 +570,28 @@
 
   mem = adjust_address (m_tramp, SImode, 4);
   emit_move_insn (mem, chain_value);
-  mem = adjust_address (m_tramp, SImode, 20);
+  mem = adjust_address (m_tramp, SImode, 16);
   emit_move_insn (mem, fnaddr);
 }
 
+/* Return true for memory offset addresses between -32768 and 32767.  */
+bool
+moxie_offset_address_p (rtx x)
+{
+  x = XEXP (x, 0);
+
+  if (GET_CODE (x) == PLUS)
+{
+  x = XEXP (x, 1);
+  if (GET_CODE (x) == CONST_INT)
+   {
+ unsigned int v = INTVAL (x)  0x8000;
+ return (v == 0x8000 || v == 0x);
+   }
+}
+  return 0;
+}
+
 /* The Global `targetm' Variable.  */
 
 /* Initialize the GCC target structure.  */
Index: gcc/config/moxie/moxie.h
===
--- gcc/config/moxie/moxie.h(revision 219054)
+++ gcc/config/moxie/moxie.h(working copy)
@@ -362,7 +362,7 @@
 #define FUNCTION_PROFILER(FILE,LABELNO) (abort (), 0)
 
 /* Trampolines for Nested Functions.  */
-#define TRAMPOLINE_SIZE (2 + 6 + 6 + 2 + 2 + 6)
+#define TRAMPOLINE_SIZE (2 + 6 + 4 + 2 + 6)
 
 /* Alignment required for trampolines, in bits.  */
 #define TRAMPOLINE_ALIGNMENT 32
@@ -462,7 +462,8 @@
op1 = XEXP(X,0);\
op2 = XEXP(X,1);\
if (GET_CODE(op1) == REG\
-CONSTANT_ADDRESS_P(op2)  \
+GET_CODE(op2) == CONST_INT   \
+IN_RANGE (INTVAL (op2), -32768, 32767)   \
 REGNO_OK_FOR_BASE_P(REGNO(op1))) \
  goto LABEL;   \
   }\
Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219056)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -266,7 +266,7 @@
lda.l  %0, %1
sto.l  %0, %1
ldo.l  %0, %1
-  [(set_attr length  2,2,6,2,6,2,6,6,6)])
+  [(set_attr length  2,2,6,2,6,2,6,4,4)])
 
 (define_insn_and_split zero_extendqisi2
   [(set (match_operand:SI 0 register_operand =r,r,r,r)
@@ -344,7 +344,7 @@
lda.b  %0, %1
sto.b  %0, %1
ldo.b  %0, %1
-  [(set_attr length  2,2,6,2,6,2,6,6,6)])
+  [(set_attr length  2,2,6,2,6,2,6,4,4)])
 
 (define_expand movhi
   [(set (match_operand:HI 0 general_operand )
@@ -372,7 +372,7 @@
lda.s  %0, %1
sto.s  %0, %1
ldo.s  %0, %1
-  [(set_attr length  2,2,6,2,6,2,6,6,6)])
+  [(set_attr length  2,2,6,2,6,2,6,4,4)])
 
 ;; -
 ;; Compare instructions
Index

[Patch, moxie] Add -mmul.x option

2014-12-24 Thread Anthony Green

I am committing the attached patch, which adds support for the mul.x and
umul.x instructions, which compute the high 32 bits of a 64-bit result
for a 32-bit multiply (signed and unsigned).  These instructions are
enabled by default for moxiebox-* configurations.

This patch also updates the add, sub, mul, div and udiv instruction
names by removing the trailing .l.


2014-12-24  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.opt (mul.x): New option.
* doc/invoke.texi (Moxie Options): Document -mmul.x.
* config/moxie/moxie.md (addsi3, mulsi3, subsi3, divsi3, udivs3):
Remove trailing .l from add, mul, sub, div and udiv
instructions.
(mulsi3_highpart, mulsidi3): Add mul.x  umul.x instruction
support (high 32-bit result of multiply).
* config/moxie/moxie.c (moxie_option_override): Force availability
of mul.x instructions for moxiebox target.
* config/moxie/moxiebox.h (TARGET_MOXIEBOX): Define.


Index: gcc/config/moxie/moxie.c
===
--- gcc/config/moxie/moxie.c(revision 219054)
+++ gcc/config/moxie/moxie.c(working copy)
@@ -249,13 +249,16 @@
 }
 
 
-/* The TARGET_OPTION_OVERRIDE worker.
-   All this curently does is set init_machine_status.  */
+/* The TARGET_OPTION_OVERRIDE worker.  */
 static void
 moxie_option_override (void)
 {
   /* Set the per-function-data initializer.  */
   init_machine_status = moxie_init_machine_status;
+
+#ifdef TARGET_MOXIEBOX  
+  target_flags = ~MASK_HAS_MULX;
+#endif
 }
 
 /* Compute the size of the local area and the size to be adjusted by the
Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 219054)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -50,7 +50,7 @@
   @
   inc%0, %2
   dec   %0, -%2
-  add.l  %0, %2)
+  add%0, %2)
 
 (define_insn subsi3
   [(set (match_operand:SI 0 register_operand =r,r)
@@ -60,7 +60,7 @@
   
   @
   dec%0, %2
-  sub.l  %0, %2)
+  sub%0, %2)
 
 (define_insn mulsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -68,15 +68,44 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mul.l  %0, %2)
+  mul%0, %2)
 
+(define_code_iterator EXTEND [sign_extend zero_extend])
+(define_code_attr mul [(sign_extend mul) (zero_extend umul)])
+
+(define_insn mulsi3_highpart
+  [(set (match_operand:SI 0 register_operand   =r)
+(truncate:SI
+ (lshiftrt:DI
+  (mult:DI (EXTEND:DI (match_operand:SI 1 register_operand  0))
+   (EXTEND:DI (match_operand:SI 2 register_operand  r)))
+  (const_int 32]
+  TARGET_HAS_MULX
+  mul.x\\t%0, %2)
+
+(define_expand mulsidi3
+  [(set (match_operand:DI 0 register_operand )
+   (mult:DI (EXTEND:DI (match_operand:SI 1 register_operand 0))
+(EXTEND:DI (match_operand:SI 2 register_operand r]
+  TARGET_HAS_MULX
+{
+  rtx hi = gen_reg_rtx (SImode);
+  rtx lo = gen_reg_rtx (SImode);
+
+  emit_insn (gen_mulsi3_highpart (hi, operands[1], operands[2]));
+  emit_insn (gen_mulsi3 (lo, operands[1], operands[2]));
+  emit_move_insn (gen_lowpart (SImode, operands[0]), lo);
+  emit_move_insn (gen_highpart (SImode, operands[0]), hi);
+  DONE;
+})
+
 (define_insn divsi3
   [(set (match_operand:SI 0 register_operand =r)
  (div:SI
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  div.l  %0, %2)
+  div%0, %2)
 
 (define_insn udivsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -84,7 +113,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  udiv.l %0, %2)
+  udiv   %0, %2)
 
 (define_insn modsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -92,7 +121,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  mod.l  %0, %2)
+  mod%0, %2)
 
 (define_insn umodsi3
   [(set (match_operand:SI 0 register_operand =r)
@@ -100,7 +129,7 @@
   (match_operand:SI 1 register_operand 0)
   (match_operand:SI 2 register_operand r)))]
   
-  umod.l %0, %2)
+  umod   %0, %2)
 
 ;; -
 ;; Unary arithmetic instructions
Index: gcc/config/moxie/moxie.opt
===
--- gcc/config/moxie/moxie.opt  (revision 219054)
+++ gcc/config/moxie/moxie.opt  (working copy)
@@ -26,6 +26,10 @@
 Target RejectNegative Report Mask(LITTLE_ENDIAN)
 Generate little-endian code
 
+mmul.x
+Target Report Mask(HAS_MULX)
+Enable MUL.X and UMUL.X instructions
+
 ; Ignored by the compiler
 mno-crt0
 Target RejectNegative
Index: gcc/config/moxie/moxiebox.h

[committed, moxie] Add use of zex instruction

2014-12-12 Thread Anthony Green

I've committed the following patch for the moxie port...

2014-12-12  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md: Add use of zex instruction.


Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 218664)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -241,10 +241,10 @@
 
 (define_insn_and_split zero_extendqisi2
   [(set (match_operand:SI 0 register_operand =r,r,r,r)
-   (zero_extend:SI (match_operand:QI 1 nonimmediate_operand 0,W,A,B)))]
+   (zero_extend:SI (match_operand:QI 1 nonimmediate_operand r,W,A,B)))]
   
   @
-   ;
+   zex.b  %0, %1
ld.b   %0, %1
lda.b  %0, %1
ldo.b  %0, %1
@@ -254,14 +254,14 @@
 {
   operands[2] = gen_lowpart (QImode, operands[0]);
 }
-  [(set_attr length 0,2,6,6)])
+  [(set_attr length 2,2,6,6)])
 
 (define_insn_and_split zero_extendhisi2
   [(set (match_operand:SI 0 register_operand =r,r,r,r)
-   (zero_extend:SI (match_operand:HI 1 nonimmediate_operand 0,W,A,B)))]
+   (zero_extend:SI (match_operand:HI 1 nonimmediate_operand r,W,A,B)))]
   
   @
-   ;
+   zex.s  %0, %1
ld.s   %0, %1
lda.s  %0, %1
ldo.s  %0, %1
@@ -271,7 +271,7 @@
 {
   operands[2] = gen_lowpart (HImode, operands[0]);
 }
-  [(set_attr length 0,2,6,6)])
+  [(set_attr length 2,2,6,6)])
 
 (define_insn extendqisi2
   [(set (match_operand:SI 0 register_operand =r)


Re: [PATCH, libffi, alpha]: Use FFI_ASSERT in ffi_closure_osf_inner

2014-09-20 Thread Anthony Green

[replying to an ancient post here..]

Uros Bizjak ubiz...@gmail.com writes:

 Hello!

 Attached patch fixes libgo reflect test failure with libffi closures.
 The gccgo compiler started to use FFI closures recently; the compiler
 passes ffi_type_void for structures with zero members.

Why not just pass an FFI_TYPE_STRUCT with zero members?

 ffi_call form src/alpha/ffi.c allows FFI_TYPE_VOID arguments in
 non-debug mode through the default: case, but ffi_closure_osf_inner
 aborts with this type of argument.

 The patch changes the default case in ffi_closure_osf_inner from abort
 to FFI_ASSERT, an this way synchronizes argument handling in both
 cases.

 2014-07-21  Uros Bizjak  ubiz...@gmail.com

 * src/alpha/ffi.c: Do not include stdlib.h.
 (ffi_closure_osf_inner) default: Use FFI_ASSERT instead of abort.

 Patch was tested with libffi testsuite on alphaev6-linux-gnu.
 Additionally, the patch fixed reflect test from the libgo testsuite
 and go.test/test/recover.go test from the gcc testsuite.

Why not add an FFI_TYPE_VOID case so it doesn't ever abort if that's
expected behaviour?  The default case is there to catch unexpected
values.

AG





 Uros.

 Index: src/alpha/ffi.c
 ===
 --- src/alpha/ffi.c   (revision 212882)
 +++ src/alpha/ffi.c   (working copy)
 @@ -27,7 +27,6 @@
  
  #include ffi.h
  #include ffi_common.h
 -#include stdlib.h
  
  /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
 all further uses in this file will refer to the 128-bit type.  */
 @@ -273,7 +272,7 @@ ffi_closure_osf_inner(ffi_closure *closure, void *
 break;
  
   default:
 -   abort ();
 +   FFI_ASSERT (0);
   }
  
argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;


[Patch] Update config.sub from upstream

2014-07-28 Thread Anthony Green

I just committed this change from upstream config.sub (there are no
changes upstream in config.guess).

Thanks,

AG


2014-07-28  Anthony Green  gr...@moxielogic.com

Import from savannah.gnu.org:
* config.sub: Update to 2014-07-28 version.


Index: config.sub
===
--- config.sub  (revision 213133)
+++ config.sub  (working copy)
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2014 Free Software Foundation, Inc.
 
-timestamp='2014-05-01'
+timestamp='2014-07-28'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -828,6 +828,10 @@
basic_machine=powerpc-unknown
os=-morphos
;;
+   moxiebox)
+   basic_machine=moxie-unknown
+   os=-moxiebox
+   ;;
msdos)
basic_machine=i386-pc
os=-msdos
@@ -1373,7 +1377,7 @@
  | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* 
\
  | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
  | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
  | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
  | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
  | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \


[Patch, moxie] Add moxiebox target

2014-07-27 Thread Anthony Green

The following binutils patches introduce a new moxie-based target
called moxiebox.  Moxiebox is a VM developed by the bitcoin community
to act as a secure, sandboxed execution environment for bitcoin
automation.

See http://github.com/jgarzik/moxiebox for more information.

I'm checking these changes in.  There's a config.sub change as well
that I'll submit through the regular process.

Thanks,

AG


For gcc...

2014-07-27  Anthony Green  gr...@moxielogic.com

* config.gcc: Add moxie-*-moxiebox* configuration.
* config/moxie/moxiebox.h: New file.

For libgcc...

2014-07-27  Anthony Green  gr...@moxielogic.com

* config.host: Add moxiebox configuration suppport.



Index: gcc/config/moxie/moxiebox.h
===
--- gcc/config/moxie/moxiebox.h (revision 0)
+++ gcc/config/moxie/moxiebox.h (working copy)
@@ -0,0 +1,47 @@
+/* Definitions for the moxiebox.
+   Copyright (C) 2014 Free Software Foundation, Inc.
+   Contributed by Anthony Green (gr...@moxielogic.com)
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3.  If not see
+http://www.gnu.org/licenses/.  */
+
+/* Target OS preprocessor built-ins.  */
+#define TARGET_OS_CPP_BUILTINS()   \
+  do   \
+{  \
+  builtin_define_std (moxie);\
+  builtin_define (__moxiebox__); \
+  builtin_assert (system=moxiebox);  \
+}  \
+  while (0)
+
+#undef LIB_SPEC
+#define LIB_SPEC \
+%{!T*:-Tmoxiebox.ld} \
+ %{!nostdlib: --start-group -lsandboxrt -lc -lgcc --end-group }
+
+#undef LINK_SPEC
+#define LINK_SPEC %{h*} %{v:-V} -EL -Bstatic
+
+#undef  ASM_SPEC
+#define ASM_SPEC -EL
+
+#undef MULTILIB_DEFAULTS
+
+#undef SIZE_TYPE
+#undef PTRDIFF_TYPE
+#undef WCHAR_TYPE
+#undef WCHAR_TYPE_SIZE
Index: gcc/config.gcc
===
--- gcc/config.gcc  (revision 212980)
+++ gcc/config.gcc  (working copy)
@@ -1168,6 +1168,12 @@
tmake_file=${tmake_file} moxie/t-moxie
tm_file=moxie/moxie.h dbxelf.h elfos.h moxie/rtems.h rtems.h 
newlib-stdint.h
;;
+moxie-*-moxiebox*)
+   gas=yes
+   gnu_ld=yes
+   tm_file=${tm_file} dbxelf.h elfos.h moxie/moxiebox.h newlib-stdint.h
+   tmake_file=${tmake_file} moxie/t-moxiebox
+   ;;
 h8300-*-rtems*)
tmake_file=${tmake_file} h8300/t-h8300 h8300/t-rtems
tm_file=h8300/h8300.h dbxelf.h elfos.h h8300/elf.h h8300/rtems.h 
rtems.h newlib-stdint.h
Index: libgcc/config.host
===
--- libgcc/config.host  (revision 212980)
+++ libgcc/config.host  (working copy)
@@ -881,9 +881,9 @@
 mn10300-*-*)
tmake_file=t-fdpbit
;;
-moxie-*-elf | moxie-*-uclinux*)
+moxie-*-elf | moxie-*-moxiebox* | moxie-*-uclinux*)
tmake_file=moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp
-   extra_parts=$extra_parts crti.o crtn.o
+   extra_parts=$extra_parts crti.o crtn.o crtbegin.o crtend.o
;;
 moxie-*-rtems*)
tmake_file=$tmake_file moxie/t-moxie t-softfp-sfdf t-softfp-excl 
t-softfp


[Patch, moxie] Fix typos

2014-04-04 Thread Anthony Green

This fixes a simple typo in my patch from a couple of days ago.  I'm
checking it in.

2014-04-04  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md (zero_extendqisi2, zero_extendhisi2): Fix
typos.

 
PR ipa/59626
Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 209126)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -247,7 +247,7 @@
;
ld.b   %0, %1
lda.b  %0, %1
-   ldo.b  %0, %1
+   ldo.b  %0, %1
   reload_completed
   [(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (zero_extend:SI (match_dup 2)))]
@@ -264,7 +264,7 @@
;
ld.s   %0, %1
lda.s  %0, %1
-   ldo.s  %0, %1
+   ldo.s  %0, %1
   reload_completed
   [(set (match_dup 2) (match_dup 1))
(set (match_dup 0) (zero_extend:SI (match_dup 2)))]


[Patch, moxie] Zero- and sign-extend values properly

2014-04-02 Thread Anthony Green

This patch does three related things for the moxie port...

1. Changes char to be unsigned by default
2. Changes WCHAR_TYPE from long int to unsigned int
3. Zero- and sign-extends values properly, sometimes using the new
sign-extension instructions.

I am committing this change even at this late stage of the GCC release
process because it only touches the moxie target directory.

AG

2014-04-02  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md (zero_extendqisi2, zero_extendhisi2)
(extendqisi2, extendhisi2): Define.
* config/moxie/moxie.h (DEFAULT_SIGNED_CHAR): Change to 0.
(WCHAR_TYPE): Change to unsigned int.


Index: gcc/config/moxie/moxie.h
===
--- gcc/config/moxie/moxie.h(revision 209042)
+++ gcc/config/moxie/moxie.h(working copy)
@@ -59,7 +59,7 @@
 #define DOUBLE_TYPE_SIZE 64
 #define LONG_DOUBLE_TYPE_SIZE 64
 
-#define DEFAULT_SIGNED_CHAR 1
+#define DEFAULT_SIGNED_CHAR 0
 
 #undef  SIZE_TYPE
 #define SIZE_TYPE unsigned int
@@ -68,7 +68,7 @@
 #define PTRDIFF_TYPE int
 
 #undef  WCHAR_TYPE
-#define WCHAR_TYPE long int
+#define WCHAR_TYPE unsigned int
 
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE BITS_PER_WORD
Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 209042)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -239,6 +239,56 @@
ldo.l  %0, %1
   [(set_attr length  2,2,6,2,6,2,6,6,6)])
 
+(define_insn_and_split zero_extendqisi2
+  [(set (match_operand:SI 0 register_operand =r,r,r,r)
+   (zero_extend:SI (match_operand:QI 1 nonimmediate_operand 0,W,A,B)))]
+  
+  @
+   ;
+   ld.b   %0, %1
+   lda.b  %0, %1
+   ldo.b  %0, %1
+  reload_completed
+  [(set (match_dup 2) (match_dup 1))
+   (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
+{
+  operands[2] = gen_lowpart (QImode, operands[0]);
+}
+  [(set_attr length 0,2,6,6)])
+
+(define_insn_and_split zero_extendhisi2
+  [(set (match_operand:SI 0 register_operand =r,r,r,r)
+   (zero_extend:SI (match_operand:HI 1 nonimmediate_operand 0,W,A,B)))]
+  
+  @
+   ;
+   ld.s   %0, %1
+   lda.s  %0, %1
+   ldo.s  %0, %1
+  reload_completed
+  [(set (match_dup 2) (match_dup 1))
+   (set (match_dup 0) (zero_extend:SI (match_dup 2)))]
+{
+  operands[2] = gen_lowpart (HImode, operands[0]);
+}
+  [(set_attr length 0,2,6,6)])
+
+(define_insn extendqisi2
+  [(set (match_operand:SI 0 register_operand =r)
+   (sign_extend:SI (match_operand:QI 1 nonimmediate_operand r)))]
+  
+  @
+   sex.b  %0, %1
+  [(set_attr length 2)])
+
+(define_insn extendhisi2
+  [(set (match_operand:SI 0 register_operand =r)
+   (sign_extend:SI (match_operand:HI 1 nonimmediate_operand r)))]
+  
+  @
+   sex.s  %0, %1
+  [(set_attr length 2)])
+
 (define_expand movqi
   [(set (match_operand:QI 0 general_operand )
(match_operand:QI 1 general_operand ))]


Re: [RS6000] libffi little-endian

2013-06-24 Thread Anthony Green
It's fine with me.  Please commit it directly to GCC and I'll put it in the 
upstream.

Thanks!

AG


- Original Message -
From: David Edelsohn dje@gmail.com
To: GCC Patches gcc-patches@gcc.gnu.org, libffi-disc...@sourceware.org, 
Alan Modra amo...@gmail.com
Sent: Sunday, June 23, 2013 10:32:44 PM
Subject: Re: [RS6000] libffi little-endian

On Sun, Jun 23, 2013 at 8:26 PM, Alan Modra amo...@gmail.com wrote:
 On Fri, Jun 07, 2013 at 12:12:17AM -0400, David Edelsohn wrote:
 On Thu, Jun 6, 2013 at 9:34 PM, Alan Modra amo...@gmail.com wrote:
  Bootstrapped and regression tested powerpc64-linux.  OK to apply?
 
  * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Support
  little-endian.
  * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

 This patch needs to be applied upstream in the libffi repository.

 All of the handling of structs in ffi.c and ffi_darwin.c doesn't need
 any changes?  Cool.  I thought there might be a padding issue.

 You were right, of course.  When we finally got around to running an
 all languages bootstrap on powerpc64le, we discovered some missing
 pieces in libffi.  The following adds some ffi.c changes to the
 previous patch (closure.S patches are unchanged).  I haven't tackled
 ffi_darwin.c.

 Bootstrapped and regression tested powerpc64-linux.  This one passes
 the libffi testsuite on powerpc64le-linux.  OK mainline and 4.8?

 * src/powerpc/ffi.c (ffi_prep_args_SYSV): Move var declaration
 before statements.
 (ffi_prep_args64): Support little-endian.
 (ffi_closure_helper_SYSV, ffi_closure_helper_LINUX64): Likewise.
 * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Likewise.
 * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Likewise.

This looks okay to me and more like the changes I expected.  Assuming
Anthony accepts it upstream.

Thanks, David


Re: [ping] Re: [patch] [libffi] do not install libffi library, headers and documentation

2013-03-26 Thread Anthony Green
For what it's worth, this patch is fine by me.  I had originally
proposed that GCC not install these bits.

As far as maintainers go, I thought that I was once listed in the
MAINTAINERS file.  Feel free to add Andrew Haley and/or myself.

Thanks,

Anthony Green

On Tue, Mar 26, 2013 at 4:28 PM, Ian Lance Taylor i...@google.com wrote:
 On Tue, Mar 26, 2013 at 1:03 PM, Matthias Klose d...@ubuntu.com wrote:
 [ping, adding the GCJ and Go maintainers]

 proposed patch at http://gcc.gnu.org/ml/gcc-patches/2013-02/msg00853.html

 As far as I know this won't affect Go.  So it's fine with me.  But I'd
 rather see this approved by a libffi maintainer.  But there is no
 libffi maintainer listed in MAINTAINERS.  Hmmm.

 Ian


 Am 19.02.2013 10:13, schrieb Richard Biener:
 On Mon, Feb 18, 2013 at 6:02 PM, Matthias Klose d...@ubuntu.com wrote:
 Am 12.02.2013 13:45, schrieb Richard Biener:
 On Tue, Feb 12, 2013 at 1:44 PM, Richard Biener
 richard.guent...@gmail.com wrote:
 On Tue, Feb 12, 2013 at 1:30 PM, Matthias Klose d...@ubuntu.com wrote:
 The libffi library, headers and documentation are still installed, 
 although
 libffi provides separate releases for a long time.  So do not install 
 these
 anymore as part of a GCC install.  Tested with a build and an install 
 with go
 and java enabled (both using libffi_convenience). Ok for the trunk?

 openSUSE is using the GCC provided libffi, so no, this is not ok (not at 
 this
 stage anyway).  Also proper not-installing libffi would work by disabling
 the maybe-install-target-libffi at the toplevel, not changing libffi 
 makfiles
 (which are supposed to be imported from upstream, no?)

 Thus, add no_install= true; to the libffi target module

 updated patch attached, checked with a make install that no ffi headers and
 libraries are installed. If not ok for 4.8, ok for 4.9 when it opens?

 I'm fine with that variant but I'd like to see another ok.  No preference 
 as to
 whether to target 4.8 or 4.9.

 Richard.

   Matthias




Re: [LIBFFI] Re: Re: [PATCH] Add support for PaX enable kernels (MPROTECT)

2013-02-21 Thread Anthony Green
On Thu, Feb 21, 2013 at 2:22 PM, Dave Korn dave.korn.cyg...@gmail.com wrote:
   Gcc-patches: Assuming AG approves, can we commit this without waiting for an
 upstream libffi release and doing a full merge?  Currently GCC HEAD won't
 build libffi (and hence libjava) without it.

This patch looks fine, thanks.  I don't plan to merge back into GCC
for at least a week or two, so I think you should commit it to the GCC
tree independently.

This means that 3.0.12 is broken for Cygwin.  Are you able to produce
test results once you apply this change?  I should probably issue a
quick 3.0.13 if the results are decent.

Thanks,

AG



 2013-02-21  Dave Korn  dave.korn.cyg...@gmail.com

 * src/closures.c (is_emutramp_enabled [!FFI_MMAP_EXEC_EMUTRAMP_PAX]):
 Move default definition outside enclosing #if scope.

 cheers,
   DaveK
 --
 (*) - Patch: http://sourceware.org/ml/libffi-discuss/2012/msg00269.html
 - Thread: http://sourceware.org/ml/libffi-discuss/2012/threads.html#00247


Re: [Patch, libffi] libffi merge

2012-12-26 Thread Anthony Green
I've committed this patch.

Thanks,

Anthony Green


On Sun, Dec 23, 2012 at 4:37 PM, Anthony Green gr...@moxielogic.com wrote:
 The attached patch is fairly complete merge of the libffi side-stream
 git repo.  Highlights include aarch64 support, blackfin support, and
 additional windows ABI support.   I will commit this in a day or two
 unless there are any objections.

 Thanks,

 Anthony Green


 2012-10-30  Magnus Granberg  zo...@gentoo.org
   Pavel Labushev  pavel.labus...@runbox.ru

 * configure.ac: New options pax_emutramp
 * configure, fficonfig.h.in: Regenerated
 * src/closures.c: New function emutramp_enabled_check() and
 checks.

 2012-10-30  Frederick Cheung  frederick.che...@gmail.com

 * configure.ac: Enable FFI_MAP_EXEC_WRIT for Darwin 12 (mountain
 lion) and future version.
 * configure: Rebuild.

 2012-10-30  James Greenhalgh  james.greenhalgh at arm.com
   Marcus Shawcroft  marcus.shawcroft at arm.com

 * README: Add details of aarch64 port.
 * src/aarch64/ffi.c: New.
 * src/aarch64/ffitarget.h: Likewise.
 * src/aarch64/sysv.S: Likewise.
 * Makefile.am: Support aarch64.
 * configure.ac: Support aarch64.
 * Makefile.in, configure: Rebuilt.

 2012-10-30  James Greenhalgh  james.greenhalgh at arm.com
   Marcus Shawcroft  marcus.shawcroft at arm.com

 * testsuite/lib/libffi.exp: Add support for aarch64.
 * testsuite/libffi.call/cls_struct_va1.c: New.
 * testsuite/libffi.call/cls_uchar_va.c: Likewise.
 * testsuite/libffi.call/cls_uint_va.c: Likewise.
 * testsuite/libffi.call/cls_ulong_va.c: Likewise.
 * testsuite/libffi.call/cls_ushort_va.c: Likewise.
 * testsuite/libffi.call/nested_struct11.c: Likewise.
 * testsuite/libffi.call/uninitialized.c: Likewise.
 * testsuite/libffi.call/va_1.c: Likewise.
 * testsuite/libffi.call/va_struct1.c: Likewise.
 * testsuite/libffi.call/va_struct2.c: Likewise.
 * testsuite/libffi.call/va_struct3.c: Likewise.

 2012-10-12  Walter Lee  w...@tilera.com

 * Makefile.am: Add TILE-Gx/TILEPro support.
 * configure.ac: Likewise.
 * Makefile.in: Regenerate.
 * configure: Likewise.
 * src/prep_cif.c (ffi_prep_cif_core): Handle TILE-Gx/TILEPro.
 * src/tile: New directory.
 * src/tile/ffi.c: New file.
 * src/tile/ffitarget.h: Ditto.
 * src/tile/tile.S: Ditto.

 2012-10-12  Matthias Klose  d...@ubuntu.com

 * generate-osx-source-and-headers.py: Normalize whitespace.

 2012-05-05  Nicolas Lelong

 * libffi.xcodeproj/project.pbxproj: Fixes.
 * README: Update for iOS builds.

 2012-04-23  Alexandre Keunecke I. de Mendonca alexandre.keune...@gmail.com

 * configure.ac: Add Blackfin/sysv support
 * Makefile.am: Add Blackfin/sysv support
 * src/bfin/ffi.c:  Add Blackfin/sysv support
 * src/bfin/ffitarget.h: Add Blackfin/sysv support

 2012-04-11  Anthony Green  gr...@moxielogic.com

 * Makefile.am (EXTRA_DIST): Add new script.
 * Makefile.in: Rebuilt.

 2012-04-11  Zachary Waldowski  zwaldow...@gmail.com

 * generate-ios-source-and-headers.py,
 libffi.xcodeproj/project.pbxproj: Support a Mac static library via
 Xcode. Set iOS compatibility to 4.0.  Move iOS trampoline
 generation into an Xcode run script phase.  Include both as
 Xcode build scripts. Don't always regenerate config files.

 2012-04-10  Anthony Green  gr...@moxielogic.com

 * src/powerpc/ffi_darwin.c (ffi_prep_args): Add missing semicolon.

 2012-04-06  Anthony Green  gr...@moxielogic.com

 * Makefile.am (EXTRA_DIST): Add new iOS/xcode files.
 * Makefile.in: Rebuilt.

 2012-04-06  Mike Lewis  mikelikes...@gmail.com

 * generate-ios-source-and-headers.py: New file.
 * libffi.xcodeproj/project.pbxproj: New file.
 * README: Update instructions on building iOS binary.
 * build-ios.sh: Delete.

 2012-04-06  Anthony Green  gr...@moxielogic.com
 * src/x86/ffi64.c (UINT128): Define differently for Intel and GNU
 compilers, then use it.

 2012-04-06  H.J. Lu  hongjiu...@intel.com

 * m4/libtool.m4 (_LT_ENABLE_LOCK): Support x32.

 2012-04-06  Anthony Green  gr...@moxielogic.com

 * testsuite/Makefile.am (EXTRA_DIST): Add missing test cases.
 * testsuite/Makefile.in: Rebuilt.

 2012-04-05  Zachary Waldowski  zwaldow...@gmail.com

 * include/ffi.h.in: Add missing trampoline table fields.
 * src/arm/sysv.S: Fix ENTRY definition, and wrap symbol references
 in CNAME.
 * src/x86/ffi.c: Wrap Windows specific code in ifdefs.

 2012-03-29  Peter Rosin  p...@lysator.liu.se

 * src/x86/win32.S (ffi_closure_raw_THISCALL): Unify the frame
 generation, fix

[Patch, moxie] Add -mno-crt0 option

2012-09-21 Thread Anthony Green
This patch adds a -mno-crt0 option, similar to what is found on the
mn10300 port.  I have checked it in.

Thanks,

AG


2012-09-21  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.opt: Add -mno-crt0 option.
* config/moxie/moxie.h (STARTFILE_SPEC): Handle -mno-crt0 option.
* doc/invoke.texi (Option Summary): Document -mno-crt0 option.


Index: gcc/config/moxie/moxie.h
===
--- gcc/config/moxie/moxie.h(revision 191288)
+++ gcc/config/moxie/moxie.h(working copy)
@@ -1,5 +1,5 @@
 /* Target Definitions for moxie.
-   Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2012  Free Software Foundation, Inc.
Contributed by Anthony Green.

This file is part of GCC.
@@ -22,7 +22,7 @@
 #define GCC_MOXIE_H

 #undef  STARTFILE_SPEC
-#define STARTFILE_SPEC crt0%O%s crti.o%s crtbegin.o%s
+#define STARTFILE_SPEC %{!mno-crt0:crt0%O%s} crti.o%s crtbegin.o%s

 /* Provide an ENDFILE_SPEC appropriate for svr4.  Here we tack on our own
magical crtend.o file (see crtstuff.c) which provides part of the
Index: gcc/config/moxie/moxie.opt
===
--- gcc/config/moxie/moxie.opt  (revision 191288)
+++ gcc/config/moxie/moxie.opt  (working copy)
@@ -25,3 +25,7 @@
 mel
 Target RejectNegative Report Mask(LITTLE_ENDIAN)
 Generate little-endian code
+
+; Ignored by the compiler
+mno-crt0
+Target RejectNegative
Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 191288)
+++ gcc/doc/invoke.texi (working copy)
@@ -777,7 +777,7 @@
 -mno-crt0  -mrelax -mliw -msetlb}

 @emph{Moxie Options}
-@gccoptlist{-meb  -mel}
+@gccoptlist{-meb -mel -mno-crt0}

 @emph{PDP-11 Options}
 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
@@ -16467,6 +16467,10 @@
 @opindex mel
 Generate little-endian code.

+@item -mno-crt0
+@opindex mno-crt0
+Do not link in the C run-time initialization object file.
+
 @end table

 @node PDP-11 Options


[Patch, moxie] bi-endian support for moxie

2012-09-13 Thread Anthony Green
Here are some changes in support of a little-endian soft-core
implementation of moxie.   We now build multilibs for both endians.
Corresponding binutils changes have already been committed and I am
checking this in.  (note: it does include  what I believe are
trivially correct doc changes - apologies in advance if I should have
waited for a review).

Thanks,

Anthony Green



2012-09-13  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.h (LINK_SPEC): Add bi-endian support.
(MULTILIB_DEFAULTS): Define.
(ASM_SPEC): Define.
(BYTES_BIG_ENDIAN, WORDS_BIG_ENDIAN): Add bi-endian support.
(TARGET_CPU_CPP_BUILTINS): Add __MOXIE_LITTLE_ENDIAN__ and
__MOXIE_BIG_ENDIAN__.
* config/moxie/t-moxie (MULTILIB_DIRNAMES, MULTILIB_OPTIONS):
Define.
* config/moxie/moxie.opt: New file.
* doc/invoke.texi (Moxie Options): Add section documenting -mel
and -meb.


Index: gcc/doc/invoke.texi
===
--- gcc/doc/invoke.texi (revision 191083)
+++ gcc/doc/invoke.texi (working copy)
@@ -776,6 +776,9 @@
 -mreturn-pointer-on-d0 @gol
 -mno-crt0  -mrelax -mliw -msetlb}

+@emph{Moxie Options}
+@gccoptlist{-meb  -mel}
+
 @emph{PDP-11 Options}
 @gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
@@ -10514,6 +10517,7 @@
 * MIPS Options::
 * MMIX Options::
 * MN10300 Options::
+* Moxie Options::
 * PDP-11 Options::
 * picoChip Options::
 * PowerPC Options::
@@ -16433,6 +16437,23 @@

 @end table

+@node Moxie Options
+@subsection Moxie Options
+@cindex Moxie Options
+
+@table @gcctabopt
+
+@item -meb
+@opindex meb
+Generate big-endian code.  This is the default for @samp{moxie-*-*}
+configurations.
+
+@item -mel
+@opindex mel
+Generate little-endian code.
+
+@end table
+
 @node PDP-11 Options
 @subsection PDP-11 Options
 @cindex PDP-11 Options
Index: gcc/config/moxie/moxie.h
===
--- gcc/config/moxie/moxie.h(revision 191083)
+++ gcc/config/moxie/moxie.h(working copy)
@@ -41,9 +41,13 @@
 #define LIB_SPEC %{!shared:%{!symbolic:-lc}}

 #undef  LINK_SPEC
-#define LINK_SPEC %{h*} %{v:-V} \
+#define LINK_SPEC %{h*} %{v:-V} %{!mel:-EB} %{mel:-EL}\
   %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic}

+#ifndef MULTILIB_DEFAULTS
+#define MULTILIB_DEFAULTS { meb }
+#endif
+
 /* Layout of Source Language Data Types */

 #define INT_TYPE_SIZE 32
@@ -192,6 +196,7 @@
 /* The Overall Framework of an Assembler File */

 #undef  ASM_SPEC
+#define ASM_SPEC %{!mel:-EB} %{mel:-EL}
 #define ASM_COMMENT_START #
 #define ASM_APP_ON 
 #define ASM_APP_OFF 
@@ -291,8 +296,8 @@
 /* Storage Layout */

 #define BITS_BIG_ENDIAN 0
-#define BYTES_BIG_ENDIAN 1
-#define WORDS_BIG_ENDIAN 1
+#define BYTES_BIG_ENDIAN ( ! TARGET_LITTLE_ENDIAN )
+#define WORDS_BIG_ENDIAN ( ! TARGET_LITTLE_ENDIAN )

 /* Alignment required for a function entry point, in bits.  */
 #define FUNCTION_BOUNDARY 16
@@ -473,8 +478,12 @@

 #define TARGET_CPU_CPP_BUILTINS() \
   { \
-builtin_define_std (moxie);  \
-builtin_define_std (MOXIE);  \
+builtin_define_std (moxie);  \
+builtin_define_std (MOXIE);  \
+if (TARGET_LITTLE_ENDIAN)  \
+  builtin_define (__MOXIE_LITTLE_ENDIAN__);  \
+else   \
+  builtin_define (__MOXIE_BIG_ENDIAN__); \
   }

 #define HAS_LONG_UNCOND_BRANCH true
Index: gcc/config/moxie/t-moxie
===
--- gcc/config/moxie/t-moxie(revision 191083)
+++ gcc/config/moxie/t-moxie(working copy)
@@ -18,3 +18,6 @@
 # along with GCC; see the file COPYING3.  If not see
 # http://www.gnu.org/licenses/.

+MULTILIB_OPTIONS = meb/mel
+MULTILIB_DIRNAMES= eb el
+
Index: gcc/config/moxie/moxie.opt
===
--- gcc/config/moxie/moxie.opt  (revision 0)
+++ gcc/config/moxie/moxie.opt  (working copy)
@@ -0,0 +1,27 @@
+; Options for the moxie compiler port.
+
+; Copyright (C) 2012 Free Software Foundation, Inc.
+;
+; This file is part of GCC.
+;
+; GCC is free software; you can redistribute it and/or modify it under
+; the terms of the GNU General Public License as published by the Free
+; Software Foundation; either version 3, or (at your option) any later
+; version.
+;
+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+; for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with GCC; see the file COPYING3.  If not see
+; http://www.gnu.org/licenses/.
+
+meb
+Target RejectNegative

[PATCH, moxie] clean up function prologues

2012-09-07 Thread Anthony Green
The prologue code for functions with large static stack space
requirements was really ugly on moxie.  This patch cleans things up
and I am committing this change.

2012-09-07  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.c (moxie_expand_prologue): Optimize prologue
for functions with large static stack requirements.
(moxie_expand_epilogue): Use $r12 instead of $r5 for pulling saved
values off of the stack.


diff --git a/gcc/gcc/config/moxie/moxie.c b/gcc/gcc/config/moxie/moxie.c
index d70eaac..567e759 100644
--- a/gcc/gcc/config/moxie/moxie.c
+++ b/gcc/gcc/config/moxie/moxie.c
@@ -1,5 +1,5 @@
 /* Target Code for moxie
-   Copyright (C) 2008, 2009, 2010, 2011  Free Software Foundation
+   Copyright (C) 2008, 2009, 2010, 2011, 2012  Free Software Foundation
Contributed by Anthony Green.

This file is part of GCC.
@@ -293,8 +293,8 @@ moxie_expand_prologue (void)

   if (cfun-machine-size_for_adjusting_sp  0)
 {
-  int i = cfun-machine-size_for_adjusting_sp;
-  while (i  255)
+  int i = cfun-machine-size_for_adjusting_sp;
+  while ((i = 255)  (i = 510))
{
  insn = emit_insn (gen_subsi3 (stack_pointer_rtx,
stack_pointer_rtx,
@@ -302,13 +302,23 @@ moxie_expand_prologue (void)
  RTX_FRAME_RELATED_P (insn) = 1;
  i -= 255;
}
-  if (i  0)
+  if (i = 255)
{
  insn = emit_insn (gen_subsi3 (stack_pointer_rtx,
stack_pointer_rtx,
GEN_INT (i)));
  RTX_FRAME_RELATED_P (insn) = 1;
}
+  else
+   {
+ rtx reg = gen_rtx_REG (SImode, MOXIE_R12);
+ insn = emit_move_insn (reg, GEN_INT (i));
+ RTX_FRAME_RELATED_P (insn) = 1;
+ insn = emit_insn (gen_subsi3 (stack_pointer_rtx,
+   stack_pointer_rtx,
+   reg));
+ RTX_FRAME_RELATED_P (insn) = 1;
+   }
 }
 }

@@ -320,7 +330,7 @@ moxie_expand_epilogue (void)

   if (cfun-machine-callee_saved_reg_size != 0)
 {
-  reg = gen_rtx_REG (Pmode, MOXIE_R5);
+  reg = gen_rtx_REG (Pmode, MOXIE_R12);
   if (cfun-machine-callee_saved_reg_size = 255)
{
  emit_move_insn (reg, hard_frame_pointer_rtx);


[libffi] Restore three commits

2012-03-29 Thread Anthony Green
My merge from a few weeks ago accidentally trampled three patches by
Kai Teitz and Eric Botcazou from last month:

http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00553.html
http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00524.html
http://gcc.gnu.org/ml/gcc-patches/2012-02/msg01163.html

I've just corrected this.

Thanks,

AG


Re: [patch, libffi] Sync merge libffi

2012-03-04 Thread Anthony Green

On 3/4/2012 7:53 PM, Matthias Klose wrote:

On 04.03.2012 22:20, Anthony Green wrote:

Hello,

The attached patch includes changes that have been reviewed, approved 
and merged

into the stand-alone libffi release tree**.

** http://github.com/atgreen/libffi


does this correspond to a libffi release or release candidate?


No, but very close.   There's still the outstanding ARM fp issue
(libffi doesn't build for soft-fp targets).  I'll sync again when 3.0.11 
is final.


Chung-Lin, this is related to your VFP support patch.  I hope you have 
time to look at this soon.  Let me know if you won't.


Thanks,

AG



Re: [patch, libffi] Sync merge libffi

2012-03-04 Thread Anthony Green

On 3/4/2012 10:22 PM, John David Anglin wrote:
I'm just wondering why Anthony Green and Redhat are listed as 
copyright holders. I can understand the Free Software Foundation 
addition since the file was contributed to it.


Simply because of changes that were made to that source file over the 
years.  For instance, in 2011 I made a small change to that file (ABI 
check change), and the copyright notice update was largely a mechanical 
byproduct (emacs mostly automates this).


I have no objection to removing this if you feel strongly about it.

AG



[patch, moxie] Fix comparison regression

2011-06-12 Thread Anthony Green
I've just committed this patch.  It makes match_operator modeless for
moxie comparisons.  This fixes a regression introduced in March by this
patch:  http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01344.html

2011-06-12  Anthony Green  gr...@moxielogic.com

* config/moxie/moxie.md (cbranchsi4): Remove mode from
comparison.


Index: gcc/config/moxie/moxie.md
===
--- gcc/config/moxie/moxie.md   (revision 174933)
+++ gcc/config/moxie/moxie.md   (working copy)
@@ -308,7 +308,7 @@
  (match_operand:SI 1 general_operand )
  (match_operand:SI 2 general_operand )))
(set (pc)
-(if_then_else (match_operator:CC 0 comparison_operator
+(if_then_else (match_operator 0 comparison_operator
[(reg:CC CC_REG) (const_int 0)])
   (label_ref (match_operand 3  ))
   (pc)))]