diff mbox

[aarch64-port-dev] RFR: Re: Error in server compiler when packing/unpacking data from arrays using shift and mask ops.

Message ID 1386257930.8800.35.camel@localhost.localdomain
State New
Headers show

Commit Message

Edward Nevill Dec. 5, 2013, 3:38 p.m. UTC
On Thu, 2013-12-05 at 14:36 +0000, Andrew Haley wrote:
> On 12/05/2013 01:01 PM, Edward Nevill wrote:
> > On Wed, 2013-12-04 at 16:07 -0500, Andy Johnson wrote:
> instruct lshift_ext(iRegLNoSp dst, iRegIorL2I src, immI scale, rFlagsReg cr) %{
>   match(Set dst (LShiftL (ConvI2L src) scale));
> 
>   ins_cost(DEFAULT_COST);
>   format %{ "sbfm $dst, $src, 64-$scale, 31\t" %}
> 
>   ins_encode %{
>     // __ sbfiz(as_Register($dst$$reg),
>     // 	     as_Register($src$$reg),
>     // 	     $scale$$constant & 63, (-$scale$$constant) & 63);
>     __ sbfm(as_Register($dst$$reg),
> 	    as_Register($src$$reg),
> 	    (-$scale$$constant) & 63, ((-$scale$$constant) & 63) - 1);
>   %}
> 
>   ins_pipe(pipe_class_default);
> %}
> 
> Note that the "sbfiz" and the "sbfm" forms should be identical.  Maybe "sbfiz" is
> easier to understand.

Yes, that is better. I used the same logic as generated by gcc.

I have opted for the sbfiz version and have also updated the format.

> Reproducer (for C2, use -Xcomp) attached.

Andy (J) - Could you take the reproducer generated by Andrew and incorporate it into the JTReg regression suite.

Ok, to push?
Ed.

--- CUT HERE ---
# HG changeset patch
# User Edward Nevill edward.nevill@linaro.org
# Date 1386257271 0
#      Thu Dec 05 15:27:51 2013 +0000
# Node ID 35346211c05e1dfa4598a9caf2dfbcdebbf4e8c0
# Parent  141fc5d4229ae66293617edb25050506932471ec
Fix lshift_ext in C2

Comments

Andrew Haley Dec. 5, 2013, 3:47 p.m. UTC | #1
On 12/05/2013 03:38 PM, Edward Nevill wrote:
> Ok, to push?

OK, ta.

Andrew.
diff mbox

Patch

diff -r 141fc5d4229a -r 35346211c05e src/cpu/aarch64/vm/aarch64.ad
--- a/src/cpu/aarch64/vm/aarch64.ad	Mon Dec 02 17:19:42 2013 +0000
+++ b/src/cpu/aarch64/vm/aarch64.ad	Thu Dec 05 15:27:51 2013 +0000
@@ -6927,11 +6927,12 @@ 
   match(Set dst (LShiftL (ConvI2L src) scale));
 
   ins_cost(DEFAULT_COST);
-  format %{ "sbfm $dst, $src, 64-$scale, 31\t" %}
-
-  ins_encode %{
-    __ sbfm(as_Register($dst$$reg),
-            as_Register($src$$reg), (64u - $scale$$constant) & 63, 31);
+  format %{ "sbfiz $dst, $src, $scale & 63, -$scale & 63\t" %}
+
+  ins_encode %{
+    __ sbfiz(as_Register($dst$$reg),
+          as_Register($src$$reg),
+          $scale$$constant & 63, (-$scale$$constant) & 63);
   %}
 
   ins_pipe(pipe_class_default);
--- CUT HERE ---