@@ -1,5 +1,6 @@
(* Auto-generate ARM Neon intrinsics tests.
- Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
+ Foundation, Inc.
Contributed by CodeSourcery.
This file is part of GCC.
@@ -51,30 +52,38 @@ let emit_prologue chan test_name =
Printf.fprintf chan "/* This file was autogenerated by
neon-testgen. */\n\n";
Printf.fprintf chan "/* { dg-do assemble } */\n";
Printf.fprintf chan "/* { dg-require-effective-target arm_neon_ok } */\n";
- Printf.fprintf chan "/* { dg-options \"-save-temps -O0\" } */\n";
+ Printf.fprintf chan "/* { dg-options \"-save-temps\" } */\n";
Printf.fprintf chan "/* { dg-add-options arm_neon } */\n";
- Printf.fprintf chan "\n#include \"arm_neon.h\"\n\n";
- Printf.fprintf chan "void test_%s (void)\n{\n" test_name
+ Printf.fprintf chan "\n#include \"arm_neon.h\"\n\n"
-(* Emit declarations of local variables that are going to be passed
+
+(* Emit function with parameters and local variables that are going
to be passed
to an intrinsic, together with one to take a returned value if needed. *)
-let emit_automatics chan c_types features =
- let emit () =
- ignore (
- List.fold_left (fun arg_number -> fun (flags, ty) ->
- let pointer_bit =
- if List.mem Pointer flags then "*" else ""
- in
- (* Const arguments to builtins are directly
- written in as constants. *)
- if not (List.mem Const flags) then
- Printf.fprintf chan " %s %sarg%d_%s;\n"
- ty pointer_bit arg_number ty;
- arg_number + 1)
- 0 (List.tl c_types))
+let emit_test_prologue chan c_types features test_name const_valuator =
+ let print_arg chan arg_number (flags, ty) =
+ (* If the argument is of const type, then directly write in the
+ constant now. *)
+ begin
+ if arg_number <> 0 then
+ Printf.fprintf chan ",\n\t";
+ let pointer_bit = if List.mem Pointer flags then "*" else ""
+ in
+ Printf.fprintf chan "%s %s arg%d_%s" ty pointer_bit arg_number ty
+ end
+ in
+ let rec print_args arg_number tys =
+ match tys with
+ [] -> ()
+ | [ty] -> print_arg chan arg_number ty
+ | ty::tys ->
+ print_arg chan arg_number ty;
+ print_args (arg_number + 1) tys
in
match c_types with
(_, return_ty) :: tys ->
+ Printf.fprintf chan "%s __attribute__ ((pcs
(\"aapcs-vfp\")))\ntest_%s (float dummy_param, " return_ty test_name;
+ print_args 0 (List.tl c_types);
+ Printf.fprintf chan ")\n{\n";
if return_ty <> "void" then begin
(* The intrinsic returns a value. We need to do explict register
allocation for vget_low tests or they fail because of copy
@@ -86,11 +95,8 @@ let emit_automatics chan c_types features =
Printf.fprintf chan " register %s out_%s asm (\"r0\");\n"
return_ty return_ty
else
- Printf.fprintf chan " %s out_%s;\n" return_ty return_ty);
- emit ())
- end else
- (* The intrinsic does not return a value. *)
- emit ()
+ Printf.fprintf chan " %s out_%s;\n" return_ty return_ty);)
+ end
| _ -> assert false
(* Emit code to call an intrinsic. *)
@@ -107,10 +113,10 @@ let emit_call chan const_valuator c_types name elt_ty =
match const_valuator with
None ->
if List.mem Pointer flags then
- Printf.fprintf chan "0"
+ Printf.fprintf chan "arg%d_%s " arg_number ty
else
- Printf.fprintf chan "1"
- | Some f -> Printf.fprintf chan "%s" (string_of_int (f arg_number))
+ Printf.fprintf chan "1 "
+ | Some f -> Printf.fprintf chan "%s " (string_of_int (f arg_number))
else
Printf.fprintf chan "arg%d_%s" arg_number ty
in
@@ -124,7 +130,9 @@ let emit_call chan const_valuator c_types name elt_ty =
print_args (arg_number + 1) tys
in
print_args 0 (List.tl c_types);
- Printf.fprintf chan ");\n"
+ Printf.fprintf chan ");\n" ;
+ (if snd (List.hd c_types) <> "void" then
+ Printf.fprintf chan " return out_%s;\n" (snd (List.hd c_types)))
(* Emit epilogue code to a test source file. *)
let emit_epilogue chan features regexps =
@@ -265,12 +273,12 @@ let test_intrinsic dir opcode features shape
name munge elt_ty =
in
(* Emit file and function prologues. *)
emit_prologue chan test_name;
- (* Emit local variable declarations. *)
- emit_automatics chan c_types features;
+ (* Emit prologue for the test function. *)
+ emit_test_prologue chan c_types features test_name const_valuator;
Printf.fprintf chan "\n";
(* Emit the call to the intrinsic. *)
emit_call chan const_valuator c_types name elt_ty;
- (* Emit the function epilogue and the DejaGNU scan-assembler
directives. *)
+ (* Emit the DejaGNU scan-assembler directives. *)
emit_epilogue chan features regexps;
(* Close the test file. *)
close_out chan
b/gcc/testsuite/gcc.target/arm/neon/neon.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2004, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2004, 2006, 2007, 2012 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -21,15 +21,8 @@ if ![istarget arm*-*-*] then {
return
}
-# Load support procs.
load_lib gcc-dg.exp
-
-# Initialize `dg'.
dg-init
-
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] \
- "" ""
-
-# All done.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cCS\]]] ""
dg-finish