summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-04-20 17:46:58 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2013-04-20 17:46:58 +0000
commit468f0c4407895557ca8089430f894a85f06afe97 (patch)
tree76d4d5bb302da822797ccbbecd8f4cfd935bf938
parent600e5f3be65eeffc80d5c4cad800121fe521a1aa (diff)
Add __builtin_bswap16 and __builtin_bswap32 to all ports.
Remove __builtin_{read,write}_reversed from IA32 and ARM ports. Machregs: tighten destroyed_by_builtin Packedstructs: use bswap if read/write-reversed not available. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2208 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
-rw-r--r--arm/CBuiltins.ml15
-rw-r--r--arm/Machregs.v4
-rw-r--r--arm/PrintAsm.ml48
-rw-r--r--cparser/PackedStructs.ml50
-rw-r--r--ia32/CBuiltins.ml15
-rw-r--r--ia32/Machregs.v10
-rw-r--r--ia32/PrintAsm.ml28
-rw-r--r--powerpc/CBuiltins.ml4
-rw-r--r--powerpc/PrintAsm.ml8
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/Results/builtins-ia325
-rw-r--r--test/regression/builtins-arm.c23
-rw-r--r--test/regression/builtins-ia32.c25
-rw-r--r--test/regression/builtins-powerpc.c (renamed from test/regression/builtins.c)27
14 files changed, 128 insertions, 136 deletions
diff --git a/arm/CBuiltins.ml b/arm/CBuiltins.ml
index 3be32e4..771243f 100644
--- a/arm/CBuiltins.ml
+++ b/arm/CBuiltins.ml
@@ -23,20 +23,15 @@ let builtins = {
(* Integer arithmetic *)
"__builtin_bswap",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap32",
+ (TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap16",
+ (TInt(IUShort, []), [TInt(IUShort, [])], false);
"__builtin_cntlz",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
(* Float arithmetic *)
"__builtin_fsqrt",
- (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);
+ (TFloat(FDouble, []), [TFloat(FDouble, [])], false)
]
}
diff --git a/arm/Machregs.v b/arm/Machregs.v
index 4906eb0..50535f0 100644
--- a/arm/Machregs.v
+++ b/arm/Machregs.v
@@ -104,7 +104,9 @@ Definition destroyed_by_jumptable: list mreg :=
Definition destroyed_by_builtin (ef: external_function): list mreg :=
match ef with
| EF_memcpy sz al => if zle sz 32 then nil else R2 :: R3 :: R12 :: nil
- | _ => R12 :: F6 :: nil
+ | EF_vstore Mfloat32 => F6 :: nil
+ | EF_vstore_global Mfloat32 _ _ => F6 :: nil
+ | _ => nil
end.
Definition destroyed_at_function_entry: list mreg :=
diff --git a/arm/PrintAsm.ml b/arm/PrintAsm.ml
index 1bac715..fc7c987 100644
--- a/arm/PrintAsm.ml
+++ b/arm/PrintAsm.ml
@@ -336,28 +336,16 @@ let print_builtin_vstore_global oc chunk id ofs args =
let n = print_builtin_vstore_common oc chunk (IR IR14 :: args) in
fprintf oc "%s end builtin __builtin_volatile_write\n" comment; n + 1
-(* Magic sequence for byte-swapping *)
-
-let print_bswap oc src tmp dst =
- (* tmp <> src, tmp <> dst, but can have dst = src *)
- (* src = A . B .C . D *)
- fprintf oc " eor %a, %a, %a, ror #16\n" ireg tmp ireg src ireg src;
- (* tmp = A^C . B^D . C^A . D^B *)
- fprintf oc " bic %a, %a, #0x00FF0000\n" ireg tmp ireg tmp;
- (* tmp = A^C . 000 . C^A . D^B *)
- fprintf oc " mov %a, %a, ror #8\n" ireg dst ireg src;
- (* dst = D . A . B . C *)
- fprintf oc " eor %a, %a, %a, lsr #8\n" ireg dst ireg dst ireg tmp
- (* dst = D . A^A^C . B . C^C^A = D . C . B . A *)
-
(* Handling of compiler-inlined builtins *)
let print_builtin_inline oc name args res =
fprintf oc "%s begin %s\n" comment name;
let n = match name, args, res with
(* Integer arithmetic *)
- | "__builtin_bswap", [IR a1], [IR res] ->
- print_bswap oc a1 IR14 res; 4
+ | ("__builtin_bswap" | "__builtin_bswap32"), [IR a1], [IR res] ->
+ fprintf oc " rev %a, %a\n" ireg res ireg a1; 1
+ | "__builtin_bswap16", [IR a1], [IR res] ->
+ fprintf oc " rev16 %a, %a\n" ireg res ireg a1; 1
| "__builtin_cntlz", [IR a1], [IR res] ->
fprintf oc " clz %a, %a\n" ireg res ireg a1; 1
(* Float arithmetic *)
@@ -400,34 +388,6 @@ 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 " mov %a, %a, lsl #8\n" ireg IR14 ireg res;
- fprintf oc " and %a, %a, #0xFF00\n" ireg IR14 ireg IR14;
- fprintf oc " orr %a, %a, %a, lsr #8\n" ireg res ireg IR14 ireg res; 4
- | "__builtin_read32_reversed", [IR a1], [IR res] ->
- fprintf oc " ldr %a, [%a, #0]\n" ireg res ireg a1;
- print_bswap oc res IR14 res; 5
- | "__builtin_write16_reversed", [IR a1; IR a2], _ ->
- fprintf oc " mov %a, %a, lsr #8\n" ireg IR14 ireg a2;
- fprintf oc " and %a, %a, #0xFF\n" ireg IR14 ireg IR14;
- fprintf oc " orr %a, %a, %a, lsl #8\n" ireg IR14 ireg IR14 ireg a2;
- fprintf oc " strh %a, [%a, #0]\n" ireg IR14 ireg a1; 4
- | "__builtin_write32_reversed", [IR a1; IR a2], _ ->
- if a1 <> IR12 then begin
- print_bswap oc a2 IR14 IR12;
- fprintf oc " str %a, [%a, #0]\n" ireg IR12 ireg a1; 5
- end else begin
- fprintf oc " mov %a, %a, lsr #24\n" ireg IR14 ireg a2;
- fprintf oc " str %a, [%a, #0]\n" ireg IR14 ireg a1;
- fprintf oc " mov %a, %a, lsr #16\n" ireg IR14 ireg a2;
- fprintf oc " str %a, [%a, #1]\n" ireg IR14 ireg a1;
- fprintf oc " mov %a, %a, lsr #8\n" ireg IR14 ireg a2;
- fprintf oc " str %a, [%a, #2]\n" ireg IR14 ireg a1;
- fprintf oc " str %a, [%a, #3]\n" ireg IR14 ireg a1;
- 7
- end
(* Catch-all *)
| _ ->
invalid_arg ("unrecognized builtin " ^ name)
diff --git a/cparser/PackedStructs.ml b/cparser/PackedStructs.ml
index b1af7f6..dbd5160 100644
--- a/cparser/PackedStructs.ml
+++ b/cparser/PackedStructs.ml
@@ -59,7 +59,7 @@ let align x boundary =
let rec can_byte_swap env ty =
match unroll env ty with
- | TInt(ik, _) -> (true, sizeof_ikind ik > 1)
+ | TInt(ik, _) -> (sizeof_ikind ik <= 4, sizeof_ikind ik > 1)
| TEnum(_, _) -> (true, sizeof_ikind enum_ikind > 1)
| TPtr(_, _) -> (true, true) (* tolerance? *)
| TArray(ty_elt, _, _) -> can_byte_swap env ty_elt
@@ -151,12 +151,9 @@ let transf_composite loc env su id attrs ml =
(* Accessor functions *)
let lookup_function loc env name =
- try
- match Env.lookup_ident env name with
- | (id, II_ident(sto, ty)) -> (id, ty)
- | (id, II_enum _) -> raise (Env.Error(Env.Unbound_identifier name))
- with Env.Error msg ->
- fatal_error "%a: Error: %s" formatloc loc (Env.error_message msg)
+ match Env.lookup_ident env name with
+ | (id, II_ident(sto, ty)) -> (id, ty)
+ | (id, II_enum _) -> raise (Env.Error(Env.Unbound_identifier name))
(* Type for the access *)
@@ -197,33 +194,56 @@ let arrow_packed_field base pf ty =
etyp = TArray(TInt(IChar,[]),None,[]) } in
ederef ty (ecast (TPtr(ty, [])) (eoffset payload pf.fi_offset))
-(* (ty) __builtin_read_NN_reversed(&lval) *)
+(* (ty) __builtin_readNN_reversed(&lval)
+ or (ty) __builtin_bswapNN(lval) *)
+
let bswap_read loc env lval =
let ty = lval.etyp in
- let (bsize, aty) =
- accessor_type loc env ty in
- if bsize = 8 then lval else begin
+ let (bsize, aty) = accessor_type loc env ty in
+ assert (bsize = 16 || bsize = 32);
+ try
let (id, fty) =
lookup_function loc env (sprintf "__builtin_read%d_reversed" bsize) in
let fn = {edesc = EVar id; etyp = fty} in
let args = [ecast_opt env (TPtr(aty,[])) (eaddrof lval)] in
let call = {edesc = ECall(fn, args); etyp = aty} in
ecast_opt env ty call
- end
+ with Env.Error _ ->
+ try
+ let (id, fty) =
+ lookup_function loc env (sprintf "__builtin_bswap%d" bsize) in
+ let fn = {edesc = EVar id; etyp = fty} in
+ let args = [ecast_opt env aty lval] in
+ let call = {edesc = ECall(fn, args); etyp = aty} in
+ ecast_opt env ty call
+ with Env.Error msg ->
+ fatal_error "%a: Error: %s" formatloc loc (Env.error_message msg)
+
+(* __builtin_write_intNN_reversed(&lhs,rhs)
+ or lhs = __builtin_bswapNN(rhs) *)
-(* __builtin_write_intNN_reversed(&lhs,rhs) *)
let bswap_write loc env lhs rhs =
let ty = lhs.etyp in
let (bsize, aty) =
accessor_type loc env ty in
- if bsize = 8 then eassign lhs rhs else begin
+ assert (bsize = 16 || bsize = 32);
+ try
let (id, fty) =
lookup_function loc env (sprintf "__builtin_write%d_reversed" bsize) in
let fn = {edesc = EVar id; etyp = fty} in
let args = [ecast_opt env (TPtr(aty,[])) (eaddrof lhs);
ecast_opt env aty rhs] in
{edesc = ECall(fn, args); etyp = TVoid[]}
- end
+ with Env.Error _ ->
+ try
+ let (id, fty) =
+ lookup_function loc env (sprintf "__builtin_bswap%d" bsize) in
+ let fn = {edesc = EVar id; etyp = fty} in
+ let args = [ecast_opt env aty rhs] in
+ let call = {edesc = ECall(fn, args); etyp = aty} in
+ eassign lhs (ecast_opt env ty call)
+ with Env.Error msg ->
+ fatal_error "%a: Error: %s" formatloc loc (Env.error_message msg)
(* Expressions *)
diff --git a/ia32/CBuiltins.ml b/ia32/CBuiltins.ml
index 596d291..4a3dde5 100644
--- a/ia32/CBuiltins.ml
+++ b/ia32/CBuiltins.ml
@@ -23,21 +23,16 @@ let builtins = {
(* Integer arithmetic *)
"__builtin_bswap",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap32",
+ (TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap16",
+ (TInt(IUShort, []), [TInt(IUShort, [])], false);
(* Float arithmetic *)
"__builtin_fsqrt",
(TFloat(FDouble, []), [TFloat(FDouble, [])], false);
"__builtin_fmax",
(TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, [])], false);
"__builtin_fmin",
- (TFloat(FDouble, []), [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);
+ (TFloat(FDouble, []), [TFloat(FDouble, []); TFloat(FDouble, [])], false)
]
}
diff --git a/ia32/Machregs.v b/ia32/Machregs.v
index 3b84aa5..a2f3c3e 100644
--- a/ia32/Machregs.v
+++ b/ia32/Machregs.v
@@ -105,11 +105,11 @@ Definition destroyed_by_builtin (ef: external_function): list mreg :=
match ef with
| EF_memcpy sz al =>
if zle sz 32 then CX :: X7 :: nil else CX :: SI :: DI :: nil
- | EF_vload _ => nil
- | EF_vload_global _ _ _ => nil
- | EF_vstore _ => AX :: CX :: X7 :: nil
- | EF_vstore_global _ _ _ => AX :: X7 :: nil
- | _ => AX :: CX :: X7 :: FP0 :: nil
+ | EF_vstore (Mint8unsigned|Mint8signed) => AX :: CX :: nil
+ | EF_vstore Mfloat32 => X7 :: nil
+ | EF_vstore_global (Mint8unsigned|Mint8signed) _ _ => AX :: nil
+ | EF_vstore_global Mfloat32 _ _ => X7 :: nil
+ | _ => nil
end.
Definition destroyed_at_function_entry: list mreg :=
diff --git a/ia32/PrintAsm.ml b/ia32/PrintAsm.ml
index c2ea98f..0878371 100644
--- a/ia32/PrintAsm.ml
+++ b/ia32/PrintAsm.ml
@@ -390,33 +390,15 @@ let print_builtin_vstore_global oc chunk id ofs args =
let print_builtin_inline oc name args res =
fprintf oc "%s begin builtin %s\n" comment name;
begin match name, args, res with
- (* Memory accesses *)
- | "__builtin_read16_reversed", [IR a1], [IR res] ->
- let tmp = if Asmgen.low_ireg res then res else ECX in
- fprintf oc " movzwl 0(%a), %a\n" ireg a1 ireg tmp;
- fprintf oc " xchg %a, %a\n" ireg8 tmp high_ireg8 tmp;
- if tmp <> res then
- fprintf oc " movl %a, %a\n" ireg tmp ireg res
- | "__builtin_read32_reversed", [IR a1], [IR res] ->
- fprintf oc " movl 0(%a), %a\n" ireg a1 ireg res;
- fprintf oc " bswap %a\n" ireg res
- | "__builtin_write16_reversed", [IR a1; IR a2], _ ->
- let tmp = if a1 = ECX then EDX else ECX in
- if a2 <> tmp then
- fprintf oc " movl %a, %a\n" ireg a2 ireg tmp;
- fprintf oc " xchg %a, %a\n" ireg8 tmp high_ireg8 tmp;
- fprintf oc " movw %a, 0(%a)\n" ireg16 tmp ireg a1
- | "__builtin_write32_reversed", [IR a1; IR a2], _ ->
- let tmp = if a1 = ECX then EDX else ECX in
- if a2 <> tmp then
- fprintf oc " movl %a, %a\n" ireg a2 ireg tmp;
- fprintf oc " bswap %a\n" ireg tmp;
- fprintf oc " movl %a, 0(%a)\n" ireg tmp ireg a1
(* Integer arithmetic *)
- | "__builtin_bswap", [IR a1], [IR res] ->
+ | ("__builtin_bswap"| "__builtin_bswap32"), [IR a1], [IR res] ->
if a1 <> res then
fprintf oc " movl %a, %a\n" ireg a1 ireg res;
fprintf oc " bswap %a\n" ireg res
+ | "__builtin_bswap16", [IR a1], [IR res] ->
+ if a1 <> res then
+ fprintf oc " movl %a, %a\n" ireg a1 ireg res;
+ fprintf oc " rolw $8, %a\n" ireg16 res
(* Float arithmetic *)
| "__builtin_fabs", [FR a1], [FR res] ->
need_masks := true;
diff --git a/powerpc/CBuiltins.ml b/powerpc/CBuiltins.ml
index ff1715b..060e2b7 100644
--- a/powerpc/CBuiltins.ml
+++ b/powerpc/CBuiltins.ml
@@ -29,6 +29,10 @@ let builtins = {
(TInt(IUInt, []), [TInt(IUInt, [])], false);
"__builtin_bswap",
(TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap32",
+ (TInt(IUInt, []), [TInt(IUInt, [])], false);
+ "__builtin_bswap16",
+ (TInt(IUShort, []), [TInt(IUShort, [])], false);
(* Float arithmetic *)
"__builtin_fmadd",
(TFloat(FDouble, []),
diff --git a/powerpc/PrintAsm.ml b/powerpc/PrintAsm.ml
index 319e12c..d48cffe 100644
--- a/powerpc/PrintAsm.ml
+++ b/powerpc/PrintAsm.ml
@@ -440,10 +440,14 @@ let print_builtin_inline oc name args res =
fprintf oc " mulhwu %a, %a, %a\n" ireg res ireg a1 ireg a2
| "__builtin_cntlz", [IR a1], [IR res] ->
fprintf oc " cntlzw %a, %a\n" ireg res ireg a1
- | "__builtin_bswap", [IR a1], [IR res] ->
+ | ("__builtin_bswap" | "__builtin_bswap32"), [IR a1], [IR res] ->
fprintf oc " stwu %a, -8(%a)\n" ireg a1 ireg GPR1;
fprintf oc " lwbrx %a, %a, %a\n" ireg res ireg_or_zero GPR0 ireg GPR1;
fprintf oc " addi %a, %a, 8\n" ireg GPR1 ireg GPR1
+ | "__builtin_bswap16", [IR a1], [IR res] ->
+ fprintf oc " rlwinm %a, %a, 8, 16, 23\n" ireg GPR0 ireg a1;
+ fprintf oc " rlwinm %a, %a, 24, 24, 31\n" ireg res ireg a1;
+ fprintf oc " or %a, %a, %a\n" ireg reg ireg GPR0 ireg res
(* Float arithmetic *)
| "__builtin_fmadd", [FR a1; FR a2; FR a3], [FR res] ->
fprintf oc " fmadd %a, %a, %a, %a\n" freg res freg a1 freg a2 freg a3
@@ -854,7 +858,7 @@ let instr_size = function
begin match ef with
| EF_builtin(name, sg) ->
begin match extern_atom name with
- | "__builtin_bswap" -> 3
+ | "__builtin_bswap" | "__builtin_bswap32" | "__builtin_bswap16" -> 3
| "__builtin_fcti" -> 4
| _ -> 1
end
diff --git a/test/regression/Makefile b/test/regression/Makefile
index 454bcef..643fba4 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -17,7 +17,7 @@ TESTS=int32 int64 floats floats-basics \
TESTS_COMP=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \
bitfields5 bitfields6 bitfields7 bitfields8 \
- packedstruct1 packedstruct2 \
+ builtins-$(ARCH) packedstruct1 packedstruct2 \
# Other tests: should compile to .s without errors (but expect warnings)
diff --git a/test/regression/Results/builtins-ia32 b/test/regression/Results/builtins-ia32
new file mode 100644
index 0000000..52d6daf
--- /dev/null
+++ b/test/regression/Results/builtins-ia32
@@ -0,0 +1,5 @@
+bswap(12345678) = 78563412
+bswap16(1234) = 3412
+fsqrt(3.141590) = 1.772453
+fmin(3.141590, 2.718000) = 2.718000
+fmax(3.141590, 2.718000) = 3.141590
diff --git a/test/regression/builtins-arm.c b/test/regression/builtins-arm.c
new file mode 100644
index 0000000..41ea88b
--- /dev/null
+++ b/test/regression/builtins-arm.c
@@ -0,0 +1,23 @@
+/* Fun with builtins */
+
+#include <stdio.h>
+
+int main(int argc, char ** argv)
+{
+ unsigned int x = 0x12345678;
+ unsigned int y = 0xDEADBEEF;
+ double a = 3.14159;
+ unsigned short s = 0x1234;
+
+ printf("bswap(%x) = %x\n", x, __builtin_bswap(x));
+ printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s));
+ printf("cntlz(%x) = %d\n", x, __builtin_cntlz(x));
+ printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
+
+ return 0;
+}
+
+
+
+
+
diff --git a/test/regression/builtins-ia32.c b/test/regression/builtins-ia32.c
new file mode 100644
index 0000000..43e4566
--- /dev/null
+++ b/test/regression/builtins-ia32.c
@@ -0,0 +1,25 @@
+/* Fun with builtin functions */
+
+#include <stdio.h>
+
+int main(int argc, char ** argv)
+{
+ unsigned int x = 0x12345678;
+ double a = 3.14159;
+ double b = 2.718;
+ unsigned short s = 0x1234;
+
+ printf("bswap(%x) = %x\n", x, __builtin_bswap(x));
+ printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s));
+
+ printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
+ printf("fmin(%f, %f) = %f\n", a, b, __builtin_fmin(a, b));
+ printf("fmax(%f, %f) = %f\n", a, b, __builtin_fmax(a, b));
+
+ return 0;
+}
+
+
+
+
+
diff --git a/test/regression/builtins.c b/test/regression/builtins-powerpc.c
index f548fd8..9f0d410 100644
--- a/test/regression/builtins.c
+++ b/test/regression/builtins-powerpc.c
@@ -4,19 +4,18 @@
int main(int argc, char ** argv)
{
- int x = 0x12345678;
+ unsigned int x = 0x12345678;
unsigned int y = 0xDEADBEEF;
double a = 3.14159;
double b = 2.718;
double c = 1.414;
unsigned short s = 0x1234;
-#if defined(__PPC__) || defined(__ppc__)
-
printf("mulhw(%x, %x) = %x\n", x, y, __builtin_mulhw(x, y));
printf("mulhwu(%x, %x) = %x\n", x, y, __builtin_mulhwu(x, y));
printf("cntlz(%x) = %d\n", x, __builtin_cntlz(x));
printf("bswap(%x) = %x\n", x, __builtin_bswap(x));
+ printf("bswap16(%x) = %x\n", s, __builtin_bswap16(s));
printf("fmadd(%f, %f, %f) = %f\n", a, b, c, __builtin_fmadd(a, b, c));
printf("fmsub(%f, %f, %f) = %f\n", a, b, c, __builtin_fmsub(a, b, c));
@@ -33,28 +32,6 @@ int main(int argc, char ** argv)
__builtin_eieio();
__builtin_sync();
__builtin_isync();
-
-#endif
-
-#ifdef __arm__
-
- printf("bswap(%x) = %x\n", x, __builtin_bswap(x));
- printf("cntlz(%x) = %d\n", x, __builtin_cntlz(x));
-
- printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
-
-#endif
-
-#ifdef __i386__
-
- printf("bswap(%x) = %x\n", x, __builtin_bswap(x));
-
- printf("fsqrt(%f) = %f\n", a, __builtin_fsqrt(a));
- printf("fmin(%f, %f) = %f\n", a, b, __builtin_fmin(a, b));
- printf("fmax(%f, %f) = %f\n", a, b, __builtin_fmax(a, b));
-
-#endif
-
printf ("read_16_rev = %x\n", __builtin_read16_reversed(&s));
printf ("read_32_rev = %x\n", __builtin_read32_reversed(&y));
__builtin_write16_reversed(&s, 0x789A);