[flang-commits] [PATCH] D129296: Lower mask intrinsics

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Jul 13 02:54:56 PDT 2022


jeanPerier added a comment.



> I do not have access to multiple Fortran compilers to test this, so I cannot attempt to match the behavior of other compilers.

You can test ifort, ifx, and gfortran results on godbolt.org, it now runs the programs in the bottom right window (link below).

This shows that they do not give unanimous results in the MASKR/MASKL non-confromant cases. Only ifx and xlf always return zeros. gfortran does not. So I think you can go for the simpler implementation here. Please add a small comment in the code that there is no common behavior of other compilers on the non conformant case so they are not dealt with in a special way.

For your other patch about the SHIFT's intrinsic, applying @klausler's rule, I think you should return zero in the non conformant cases since that seems to be a common behavior of the other compilers.

See for instance this maskr/maskl example on godbolt.org <https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,selection:(endColumn:16,endLineNumber:8,positionColumn:16,positionLineNumber:8,selectionStartColumn:16,selectionStartLineNumber:8,startColumn:16,startLineNumber:8),source:'!!+Type+your+code+here,+or+load+an+example.%0Asubroutine+test(i)%0A++print+*,+maskl(i)%0A++print+*,+maskr(i)%0Aend+subroutine%0A%0A+++call+test(-4)%0A+++call+test(37)%0A+end%0A'),l:'5',n:'0',o:'Fortran+source+%231',t:'0')),k:49.9194847020934,l:'4',n:'0',o:'',s:0,t:'0'),(g:!((g:!((h:compiler,i:(compiler:gfortransnapshot,filters:(b:'0',binary:'1',commentOnly:'0',demangle:'0',directives:'0',execute:'0',intel:'0',libraryCode:'0',trim:'1'),flagsViewOpen:'1',fontScale:14,fontUsePx:'0',j:1,lang:fortran,libs:!(),options:'',selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1,tree:'1'),l:'5',n:'0',o:'x86-64+gfortran+(trunk)+(Fortran,+Editor+%231,+Compiler+%231)',t:'0')),k:50,l:'4',m:61.18279569892473,n:'0',o:'',s:0,t:'0'),(g:!((h:output,i:(compilerName:'x86-64+gcc+12.1',editorid:1,fontScale:14,fontUsePx:'0',j:1,wrap:'1'),l:'5',n:'0',o:'Output+of+x86-64+gfortran+(trunk)+(Compiler+%231)',t:'0')),header:(),l:'4',m:38.81720430107527,n:'0',o:'',s:0,t:'0')),k:50.0805152979066,l:'3',n:'0',o:'',t:'0')),l:'2',n:'0',o:'',t:'0')),version:4>


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129296/new/

https://reviews.llvm.org/D129296



More information about the flang-commits mailing list