@@ -105,6 +105,11 @@ let intrinsic_groups =
"Multiply-subtract", single_opcode Vmls;
"Fused-multiply-accumulate", single_opcode Vfma;
"Fused-multiply-subtract", single_opcode Vfms;
+ "Round to integral (to nearest, ties to even)", single_opcode Vrintn;
+ "Round to integral (to nearest, ties away from zero)", single_opcode Vrinta;
+ "Round to integral (towards +Inf)", single_opcode Vrintp;
+ "Round to integral (towards -Inf)", single_opcode Vrintm;
+ "Round to integral (towards 0)", single_opcode Vrintz;
"Subtraction", single_opcode Vsub;
"Comparison (equal-to)", single_opcode Vceq;
"Comparison (greater-than-or-equal-to)", single_opcode Vcge;
@@ -290,17 +290,21 @@ let print_feature_test_start features =
try
match List.find (fun feature ->
match feature with Requires_feature _ -> true
+ | Requires_arch _ -> true
| _ -> false)
features with
Requires_feature feature ->
Format.printf "#ifdef __ARM_FEATURE_%s@\n" feature
+ | Requires_arch arch ->
+ Format.printf "#if __ARM_ARCH >= %d@\n" arch
| _ -> assert false
with Not_found -> assert true
let print_feature_test_end features =
let feature =
List.exists (function Requires_feature x -> true
- | _ -> false) features in
+ | Requires_arch x -> true
+ | _ -> false) features in
if feature then Format.printf "#endif@\n"
@@ -162,9 +162,11 @@ let effective_target features =
try
match List.find (fun feature ->
match feature with Requires_feature _ -> true
+ | Requires_arch _ -> true
| _ -> false)
features with
Requires_feature "FMA" -> "arm_neonv2"
+ | Requires_arch 8 -> "arm_v8_neon"
| _ -> assert false
with Not_found -> "arm_neon"
@@ -152,6 +152,11 @@ type opcode =
| Vqdmulh_n
| Vqdmulh_lane
(* Unary ops. *)
+ | Vrintn
+ | Vrinta
+ | Vrintp
+ | Vrintm
+ | Vrintz
| Vabs
| Vneg
| Vcls
@@ -279,6 +285,7 @@ type features =
| Fixed_core_reg
(* Mark that the intrinsic requires __ARM_FEATURE_string to be defined. *)
| Requires_feature of string
+ | Requires_arch of int
exception MixedMode of elts * elts
@@ -812,6 +819,27 @@ let ops =
Vfms, [Requires_feature "FMA"], All (3, Dreg), "vfms", elts_same_io, [F32];
Vfms, [Requires_feature "FMA"], All (3, Qreg), "vfmsQ", elts_same_io, [F32];
+ (* Round to integral. *)
+ Vrintn, [Builtin_name "vrintn"; Requires_arch 8], Use_operands [| Dreg; Dreg |],
+ "vrndn", elts_same_1, [F32];
+ Vrintn, [Builtin_name "vrintn"; Requires_arch 8], Use_operands [| Qreg; Qreg |],
+ "vrndqn", elts_same_1, [F32];
+ Vrinta, [Builtin_name "vrinta"; Requires_arch 8], Use_operands [| Dreg; Dreg |],
+ "vrnda", elts_same_1, [F32];
+ Vrinta, [Builtin_name "vrinta"; Requires_arch 8], Use_operands [| Qreg; Qreg |],
+ "vrndqa", elts_same_1, [F32];
+ Vrintp, [Builtin_name "vrintp"; Requires_arch 8], Use_operands [| Dreg; Dreg |],
+ "vrndp", elts_same_1, [F32];
+ Vrintp, [Builtin_name "vrintp"; Requires_arch 8], Use_operands [| Qreg; Qreg |],
+ "vrndqp", elts_same_1, [F32];
+ Vrintm, [Builtin_name "vrintm"; Requires_arch 8], Use_operands [| Dreg; Dreg |],
+ "vrndm", elts_same_1, [F32];
+ Vrintm, [Builtin_name "vrintm"; Requires_arch 8], Use_operands [| Qreg; Qreg |],
+ "vrndqm", elts_same_1, [F32];
+ Vrintz, [Builtin_name "vrintz"; Requires_arch 8], Use_operands [| Dreg; Dreg |],
+ "vrnd", elts_same_1, [F32];
+ Vrintz, [Builtin_name "vrintz"; Requires_arch 8], Use_operands [| Qreg; Qreg |],
+ "vrndq", elts_same_1, [F32];
(* Subtraction. *)
Vsub, [], All (3, Dreg), "vsub", sign_invar_2, F32 :: su_8_32;
Vsub, [No_op], All (3, Dreg), "vsub", sign_invar_2, [S64; U64];