diff options
author | clyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-18 11:19:52 +0000 |
---|---|---|
committer | clyon <clyon@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-18 11:19:52 +0000 |
commit | 4776ca9003c60322e172b6b26ac52d2940a67823 (patch) | |
tree | 8dd1dde3d91d0ddce4bd64e5f1ab36960a5d9bd1 /gcc/config/arm/neon-testgen.ml | |
parent | 266716bdfedc16492eac67d2ed3789079dbfa405 (diff) | |
download | gcc-4776ca9003c60322e172b6b26ac52d2940a67823.tar.gz |
2014-11-18 Christophe Lyon <christophe.lyon@linaro.org>
gcc/
* config/arm/neon-testgen.ml (emit_prologue): Handle new
compile_test_optim argument.
(emit_automatics): Rename to emit_variables. Support variable
indentation of its output.
(compile_test_optim): New function.
(test_intrinsic): Call compile_test_optim.
* config/arm/neon.ml (features): Add Compiler_optim.
(ops): Add Compiler_optim feature to Vbic and Vorn.
(type_in_crypto_only): Replace 'or' by '||'.
(reinterp): Likewise.
(reinterpq): Likewise.
testsuite/
* gcc.target/arm/neon/vbicQs16.c: Regenerate.
* gcc.target/arm/neon/vbicQs32.c: Likewise.
* gcc.target/arm/neon/vbicQs64.c: Likewise.
* gcc.target/arm/neon/vbicQs8.c: Likewise.
* gcc.target/arm/neon/vbicQu16.c: Likewise.
* gcc.target/arm/neon/vbicQu32.c: Likewise.
* gcc.target/arm/neon/vbicQu64.c: Likewise.
* gcc.target/arm/neon/vbicQu8.c: Likewise.
* gcc.target/arm/neon/vbics16.c: Likewise.
* gcc.target/arm/neon/vbics32.c: Likewise.
* gcc.target/arm/neon/vbics64.c: Likewise.
* gcc.target/arm/neon/vbics8.c: Likewise.
* gcc.target/arm/neon/vbicu16.c: Likewise.
* gcc.target/arm/neon/vbicu32.c: Likewise.
* gcc.target/arm/neon/vbicu64.c: Likewise.
* gcc.target/arm/neon/vbicu8.c: Likewise.
* gcc.target/arm/neon/vornQs16.c: Likewise.
* gcc.target/arm/neon/vornQs32.c: Likewise.
* gcc.target/arm/neon/vornQs64.c: Likewise.
* gcc.target/arm/neon/vornQs8.c: Likewise.
* gcc.target/arm/neon/vornQu16.c: Likewise.
* gcc.target/arm/neon/vornQu32.c: Likewise.
* gcc.target/arm/neon/vornQu64.c: Likewise.
* gcc.target/arm/neon/vornQu8.c: Likewise.
* gcc.target/arm/neon/vorns16.c: Likewise.
* gcc.target/arm/neon/vorns32.c: Likewise.
* gcc.target/arm/neon/vorns64.c: Likewise.
* gcc.target/arm/neon/vorns8.c: Likewise.
* gcc.target/arm/neon/vornu16.c: Likewise.
* gcc.target/arm/neon/vornu32.c: Likewise.
* gcc.target/arm/neon/vornu64.c: Likewise.
* gcc.target/arm/neon/vornu8.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217707 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/arm/neon-testgen.ml')
-rw-r--r-- | gcc/config/arm/neon-testgen.ml | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/gcc/config/arm/neon-testgen.ml b/gcc/config/arm/neon-testgen.ml index df429f59e27..f3898193835 100644 --- a/gcc/config/arm/neon-testgen.ml +++ b/gcc/config/arm/neon-testgen.ml @@ -46,20 +46,19 @@ let open_test_file dir name = failwith ("Could not create test source file " ^ name ^ ": " ^ str) (* Emit prologue code to a test source file. *) -let emit_prologue chan test_name effective_target = +let emit_prologue chan test_name effective_target compile_test_optim = Printf.fprintf chan "/* Test the `%s' ARM Neon intrinsic. */\n" 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 %s_ok } */\n" effective_target; - Printf.fprintf chan "/* { dg-options \"-save-temps -O0\" } */\n"; + Printf.fprintf chan "/* { dg-options \"-save-temps %s\" } */\n" compile_test_optim; Printf.fprintf chan "/* { dg-add-options %s } */\n" effective_target; - 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 declarations of 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_variables chan c_types features spaces = let emit () = ignore ( List.fold_left (fun arg_number -> fun (flags, ty) -> @@ -69,8 +68,8 @@ let emit_automatics chan c_types features = (* 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; + Printf.fprintf chan "%s%s %sarg%d_%s;\n" + spaces ty pointer_bit arg_number ty; arg_number + 1) 0 (List.tl c_types)) in @@ -81,13 +80,13 @@ let emit_automatics chan c_types features = allocation for vget_low tests or they fail because of copy elimination. *) ((if List.mem Fixed_vector_reg features then - Printf.fprintf chan " register %s out_%s asm (\"d18\");\n" - return_ty return_ty + Printf.fprintf chan "%sregister %s out_%s asm (\"d18\");\n" + spaces return_ty return_ty else if List.mem Fixed_core_reg features then - Printf.fprintf chan " register %s out_%s asm (\"r0\");\n" - return_ty return_ty + Printf.fprintf chan "%sregister %s out_%s asm (\"r0\");\n" + spaces return_ty return_ty else - Printf.fprintf chan " %s out_%s;\n" return_ty return_ty); + Printf.fprintf chan "%s%s out_%s;\n" spaces return_ty return_ty); emit ()) end else (* The intrinsic does not return a value. *) @@ -173,6 +172,17 @@ let effective_target features = | _ -> assert false with Not_found -> "arm_neon" +(* Work out what the testcase optimization level should be, default to -O0. *) +let compile_test_optim features = + try + match List.find (fun feature -> + match feature with Compiler_optim _ -> true + | _ -> false) + features with + Compiler_optim opt -> opt + | _ -> assert false + with Not_found -> "-O0" + (* Given an intrinsic shape, produce a regexp that will match the right-hand sides of instructions generated by an intrinsic of that shape. *) @@ -280,12 +290,22 @@ let test_intrinsic dir opcode features shape name munge elt_ty = "!?\\(\\[ \t\\]+@\\[a-zA-Z0-9 \\]+\\)?\\n") (analyze_all_shapes features shape analyze_shape) in - let effective_target = effective_target features + let effective_target = effective_target features in + let compile_test_optim = compile_test_optim features in (* Emit file and function prologues. *) - emit_prologue chan test_name effective_target; - (* Emit local variable declarations. *) - emit_automatics chan c_types features; + emit_prologue chan test_name effective_target compile_test_optim; + + if (compare compile_test_optim "-O0") <> 0 then + (* Emit variable declarations. *) + emit_variables chan c_types features ""; + + Printf.fprintf chan "void test_%s (void)\n{\n" test_name; + + if compare compile_test_optim "-O0" = 0 then + (* Emit variable declarations. *) + emit_variables chan c_types features " "; + Printf.fprintf chan "\n"; (* Emit the call to the intrinsic. *) emit_call chan const_valuator c_types name elt_ty; |