Validation of adding left shift stmt at GIMPLE - [Custom GCC plugin]]

2022-02-18 Thread Shubham Narlawar via Gcc
Hello,

I want to know whether it is correct to add left shift instruction to
a constant expression statement like "_3 + 4"?

I am trying to add a left shift instruction in between below GIMPLE
instructions -

   :
  instrn_buffer.0_1 = instrn_buffer;
  _2 = tree.cnt;
  _3 = (int) _2;
  _4 = _3 + 4;
  _5 = (unsigned int) _4;// I want to add left shift here
  D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, _5);
//this is "stmt"

I am using this snippet in custom gcc plugin -

  tree lshift_tmp = make_temp_ssa_name (integer_type_node,
NULL, "slli");
  gimple *lshift = gimple_build_assign (lshift_tmp, LSHIFT_EXPR, parm,
  build_int_cst
(integer_type_node, 8));
  gsi_insert_before(&gsi, lshift, GSI_NEW_STMT);
  //Update function call
  gimple_call_set_arg (stmt, idx, lshift_tmp);
  update_stmt (stmt);
  update_ssa (TODO_update_ssa);

from which above GIMPLE IR is modified to -

   :
  instrn_buffer.0_1 = instrn_buffer;
  _2 = tree.cnt;
  _3 = (int) _2;
  _4 = _3 + 4;
  _5 = (unsigned int) _4;
  slli_24 = _5 << 8;
  D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, slli_24);


1. When I run above code, either dominator tree validation or tree cfg
fixup is failing which suggests to me it is either incorrect to apply
such left shift or some more work is missing?

2. I followed how a left shift gimple assignment is generated but
still feels there is something wrong with the above generation. Can
someone please point me out?

Thanks in advance! As always, the GCC community and its members are
very supportive, responsive and helpful!

Regards,
Shubham


Re: Validation of adding left shift stmt at GIMPLE - [Custom GCC plugin]]

2022-02-18 Thread Andrew Pinski via Gcc
On Fri, Feb 18, 2022 at 11:04 AM Shubham Narlawar via Gcc
 wrote:
>
> Hello,
>
> I want to know whether it is correct to add left shift instruction to
> a constant expression statement like "_3 + 4"?
>
> I am trying to add a left shift instruction in between below GIMPLE
> instructions -
>
>:
>   instrn_buffer.0_1 = instrn_buffer;
>   _2 = tree.cnt;
>   _3 = (int) _2;
>   _4 = _3 + 4;
>   _5 = (unsigned int) _4;// I want to add left shift here
>   D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, _5);
> //this is "stmt"
>
> I am using this snippet in custom gcc plugin -
>
>   tree lshift_tmp = make_temp_ssa_name (integer_type_node,
> NULL, "slli");

A couple of things.
I Noticed you use integer_type_node here. Why not the type of what is
being replaced?
That is the main thing I see right now.

Also you shouldn't need to do:
update_ssa (TODO_update_ssa);

As make_temp_ssa_name is a new SSA name already and such.

Thanks,
Andrew Pinski

>   gimple *lshift = gimple_build_assign (lshift_tmp, LSHIFT_EXPR, parm,
>   build_int_cst
> (integer_type_node, 8));
>   gsi_insert_before(&gsi, lshift, GSI_NEW_STMT);
>   //Update function call
>   gimple_call_set_arg (stmt, idx, lshift_tmp);
>   update_stmt (stmt);
>   update_ssa (TODO_update_ssa);
>
> from which above GIMPLE IR is modified to -
>
>:
>   instrn_buffer.0_1 = instrn_buffer;
>   _2 = tree.cnt;
>   _3 = (int) _2;
>   _4 = _3 + 4;
>   _5 = (unsigned int) _4;
>   slli_24 = _5 << 8;
>   D.2993 = __builtin_riscv_sfploadi (instrn_buffer.0_1, 0, slli_24);
>
>
> 1. When I run above code, either dominator tree validation or tree cfg
> fixup is failing which suggests to me it is either incorrect to apply
> such left shift or some more work is missing?
>
> 2. I followed how a left shift gimple assignment is generated but
> still feels there is something wrong with the above generation. Can
> someone please point me out?
>
> Thanks in advance! As always, the GCC community and its members are
> very supportive, responsive and helpful!
>
> Regards,
> Shubham


gcc-10-20220218 is now available

2022-02-18 Thread GCC Administrator via Gcc
Snapshot gcc-10-20220218 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/10-20220218/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 10 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-10 revision e2d275aebd2bd790dd02f8961fb6a3fb1c094978

You'll find:

 gcc-10-20220218.tar.xz   Complete GCC

  SHA256=61b7d34e4fe888e79c3513cb96ef87ca73fb058d9225e2fe67cd79bbddd4bff8
  SHA1=ecef8df32e70217a984c94397b5327611c5a9102

Diffs from 10-20220211 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-10
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.


OMPD implementation

2022-02-18 Thread Mohamed Atef via Gcc
Hi,
Can anyone of OpenMP contributors review my last patch?

Thanks

Mohamed


How to get started with Contribution

2022-02-18 Thread Purvak Baliyan via Gcc
Respected Sir/Madam

I am Purvak Baliyan, an Information Technology undergrad, I have entered my
third year at DR. Akhilesh Das Gupta Institute of Technology &
Management(ADGITM). I am new to open source contributions but i am well
aware of C/C++, Data Structure and Algorithms, and HTML & CSS. I would love
to contribute to your organisation but could you please tell me how to get
started?

Hoping to hear from you soon.

Regards

Purvak