[aarch64-port-dev ] Add support for a few simple intrinsics
Edward Nevill
edward.nevill at linaro.org
Tue Jul 1 15:31:50 UTC 2014
Hi,
The following patch adds support for Sqrt, CountLeadingZeros and CountTrailingZeros.
All the best,
Ed.
--- CUT HERE ---
# HG changeset patch
# User Edward Nevill edward.nevill at linaro.org
# Date 1404228543 -3600
# Tue Jul 01 16:29:03 2014 +0100
# Node ID 6f6401730e4d350fad0f968c3116df0ada2c009f
# Parent 511a29302d283ba14baaaadea3a03fc583f56bf0
Add support for a few simple intrinsics
diff -r 511a29302d28 -r 6f6401730e4d src/cpu/aarch64/vm/aarch64.ad
--- a/src/cpu/aarch64/vm/aarch64.ad Mon Jun 23 18:56:33 2014 +0100
+++ b/src/cpu/aarch64/vm/aarch64.ad Tue Jul 01 16:29:03 2014 +0100
@@ -5922,6 +5922,61 @@
%}
// ============================================================================
+// Zero Count Instructions
+
+instruct countLeadingZerosI(iRegI dst, iRegI src) %{
+ match(Set dst (CountLeadingZerosI src));
+
+ ins_cost(INSN_COST);
+ format %{ "clzw $dst, $src" %}
+ ins_encode %{
+ __ clzw(as_Register($dst$$reg), as_Register($src$$reg));
+ %}
+
+ ins_pipe( pipe_class_default );
+%}
+
+instruct countLeadingZerosL(iRegI dst, iRegL src) %{
+ match(Set dst (CountLeadingZerosL src));
+
+ ins_cost(INSN_COST);
+ format %{ "clz $dst, $src" %}
+ ins_encode %{
+ __ clz(as_Register($dst$$reg), as_Register($src$$reg));
+ %}
+
+ ins_pipe( pipe_class_default );
+%}
+
+instruct countTrailingZerosI(iRegI dst, iRegI src) %{
+ match(Set dst (CountTrailingZerosI src));
+
+ ins_cost(INSN_COST * 2);
+ format %{ "rbitw $dst, $src\n\t"
+ "clzw $dst, $dst" %}
+ ins_encode %{
+ __ rbitw(as_Register($dst$$reg), as_Register($src$$reg));
+ __ clzw(as_Register($dst$$reg), as_Register($dst$$reg));
+ %}
+
+ ins_pipe( pipe_class_default );
+%}
+
+instruct countTrailingZerosL(iRegI dst, iRegL src) %{
+ match(Set dst (CountTrailingZerosL src));
+
+ ins_cost(INSN_COST * 2);
+ format %{ "rbit $dst, $src\n\t"
+ "clz $dst, $dst" %}
+ ins_encode %{
+ __ rbit(as_Register($dst$$reg), as_Register($src$$reg));
+ __ clz(as_Register($dst$$reg), as_Register($dst$$reg));
+ %}
+
+ ins_pipe( pipe_class_default );
+%}
+
+// ============================================================================
// MemBar Instruction
instruct load_fence() %{
@@ -9684,6 +9739,32 @@
ins_pipe(pipe_class_default);
%}
+instruct sqrtD_reg(vRegD dst, vRegD src) %{
+ match(Set dst (SqrtD src));
+
+ ins_cost(INSN_COST * 50);
+ format %{ "fsqrtd $dst, $src" %}
+ ins_encode %{
+ __ fsqrtd(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src$$reg));
+ %}
+
+ ins_pipe(pipe_class_default);
+%}
+
+instruct sqrtF_reg(vRegF dst, vRegF src) %{
+ match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
+
+ ins_cost(INSN_COST * 50);
+ format %{ "fsqrts $dst, $src" %}
+ ins_encode %{
+ __ fsqrtd(as_FloatRegister($dst$$reg),
+ as_FloatRegister($src$$reg));
+ %}
+
+ ins_pipe(pipe_class_default);
+%}
+
// ============================================================================
// Logical Instructions
--- CUT HERE ---
More information about the aarch64-port-dev
mailing list