diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-04-29 07:51:00 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2013-04-29 07:51:00 +0000 |
commit | fbdff974fe7d2040c25dee1d35781f7e70d87d6c (patch) | |
tree | 14f112a70481f467e581ca59136eed42601ce725 /arm | |
parent | e1fc4beb37252b6248c0e0ca4cf5ec00a45190bf (diff) |
Revert suppression of __builtin_{read,write}_reversed for x86 and ARM,
for compatibility with earlier CompCert versions.
But don't use them in PackedStructs.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2216 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'arm')
-rw-r--r-- | arm/CBuiltins.ml | 11 | ||||
-rw-r--r-- | arm/PrintAsm.ml | 13 |
2 files changed, 23 insertions, 1 deletions
diff --git a/arm/CBuiltins.ml b/arm/CBuiltins.ml index 771243f..ad739f1 100644 --- a/arm/CBuiltins.ml +++ b/arm/CBuiltins.ml @@ -31,7 +31,16 @@ let builtins = { (TInt(IUInt, []), [TInt(IUInt, [])], false); (* Float arithmetic *) "__builtin_fsqrt", - (TFloat(FDouble, []), [TFloat(FDouble, [])], false) + (TFloat(FDouble, []), [TFloat(FDouble, [])], false); + (* Memory accesses *) + "__builtin_read16_reversed", + (TInt(IUShort, []), [TPtr(TInt(IUShort, [AConst]), [])], false); + "__builtin_read32_reversed", + (TInt(IUInt, []), [TPtr(TInt(IUInt, [AConst]), [])], false); + "__builtin_write16_reversed", + (TVoid [], [TPtr(TInt(IUShort, []), []); TInt(IUShort, [])], false); + "__builtin_write32_reversed", + (TVoid [], [TPtr(TInt(IUInt, []), []); TInt(IUInt, [])], false); ] } diff --git a/arm/PrintAsm.ml b/arm/PrintAsm.ml index fc7c987..1d46416 100644 --- a/arm/PrintAsm.ml +++ b/arm/PrintAsm.ml @@ -388,6 +388,19 @@ let print_builtin_inline oc name args res = end else begin fprintf oc " umull %a, %a, %a, %a\n" ireg rl ireg rh ireg a ireg b; 1 end + (* Memory accesses *) + | "__builtin_read16_reversed", [IR a1], [IR res] -> + fprintf oc " ldrh %a, [%a, #0]\n" ireg res ireg a1; + fprintf oc " rev16 %a, %a\n" ireg res ireg res; 2 + | "__builtin_read32_reversed", [IR a1], [IR res] -> + fprintf oc " ldr %a, [%a, #0]\n" ireg res ireg a1; + fprintf oc " rev %a, %a\n" ireg res ireg res; 2 + | "__builtin_write16_reversed", [IR a1; IR a2], _ -> + fprintf oc " rev16 %a, %a\n" ireg IR14 ireg a2; + fprintf oc " strh %a, [%a, #0]\n" ireg IR14 ireg a1; 2 + | "__builtin_write32_reversed", [IR a1; IR a2], _ -> + fprintf oc " rev %a, %a\n" ireg IR14 ireg a2; + fprintf oc " str %a, [%a, #0]\n" ireg IR14 ireg a1; 2 (* Catch-all *) | _ -> invalid_arg ("unrecognized builtin " ^ name) |