Hi Richard,

On 05/10/2017 05:32 PM, Philippe Mathieu-Daudé wrote:
On 05/10/2017 05:20 PM, Richard Henderson wrote:
On 05/10/2017 01:05 PM, Philippe Mathieu-Daudé wrote:
-    tcg_gen_shri_i32(t1, t1, 8);
-    tcg_gen_andi_i32(t1, t1, 0x00ff00ff);
+    tcg_gen_extract_i32(t1, t1, 8, 0x00ff00ff);

This is very wrong.  See my previous comment.

Indeed, after correcting the script:

$ docker run -it -v `pwd`:`pwd` -w `pwd` petersenna/coccinelle --sp-file scripts/coccinelle/tcg_gen_extract.cocci --macro-file scripts/cocci-macro-file.h target/arm/translate.c --in-place
init_defs_builtins: /usr/lib64/coccinelle/standard.h
init_defs: scripts/cocci-macro-file.h
HANDLING: target/arm/translate.c
candidate at target/arm/translate.c:4703
  op_size: i32/i32 (same)
  low_bits: 8 (value: 0xff)
  len: 0xff00ff
  len_bits != low_bits
  candidate is NOT optimizable

candidate at target/arm/translate.c:342
  op_size: i32/i32 (same)
  low_bits: 8 (value: 0xff)
  len: 0xff00ff
  len_bits != low_bits
  candidate is NOT optimizable


Arghhh I see, I checked manually and though I had it...

I'll first check with the cocci script if it can handles this better
then review the serie manually before bother you again.

Thinking about it, this should be quite easy unit-testable somehow ...
Not sure if I want to start this path although.

Sorry for the noise and thank a lot for the review!

Phil.

Reply via email to