24 Commits

Author SHA1 Message Date
jeanPerier
8ddfb66903
[flang] Fix MASKR/MASKL lowering for INTEGER(16) (#87496)
The all one masks was not properly created for i128 types because
builder.createIntegerConstant ended-up truncating -1 to something
positive.

Add a builder.createAllOnesInteger/createMinusOneInteger helpers and use
them where createIntegerConstant(..., -1) was used.
Add an assert in createIntegerConstant to catch negative numbers for
i128 type.
2024-04-08 10:18:56 +02:00
jeanPerier
a4798bb0b6
[flang][NFC] use mlir::SymbolTable in lowering (#86673)
Whenever lowering is checking if a function or global already exists in
the mlir::Module, it was doing module->lookup.

On big programs (~5000 globals and functions), this causes important
slowdowns because these lookups are linear. Use mlir::SymbolTable to
speed-up these lookups. The SymbolTable has to be created from the
ModuleOp and maintained in sync. It is therefore placed in the
converter, and FirOPBuilders can take a pointer to it to speed-up the
lookups.

This patch does not bring mlir::SymbolTable to FIR/HLFIR passes, but
some passes creating a lot of runtime calls could benefit from it too.
More analysis will be needed.

As an example of the speed-ups, this patch speeds-up compilation of
Whizard compare_amplitude_UFO.F90 from 5 mins to 2 mins on my machine
(there is still room for speed-ups).
2024-04-02 14:29:29 +02:00
Kelvin Li
2de024ef31 [flang] Add PowerPC vec_lxv, vec_lvsl, vec_lvsr, vec_xl, vec_xl_be and vec_xlds intrinsic
Differential Revision: https://reviews.llvm.org/D157920
2023-08-18 15:02:15 -04:00
Kelvin Li
59c59a31f6 [flang] Add the endianness check for vec_sld and vec_sldw intrinsics
Differential Revision: https://reviews.llvm.org/D158189
2023-08-18 10:18:11 -04:00
Daniel Chen
c09d3c1ead [flang] Add PowerPC MMA intrinsics - part 2 2023-08-15 13:56:28 -04:00
Kelvin Li
88968f9a73 [flang] Add PowerPC vec_ld, vec_lde, vec_ldl, vec_lxvp, vsx_lxvp, vec_xld2 and vec_xlw4 intrinsic
Differential Revision: https://reviews.llvm.org/D157745
2023-08-14 16:58:35 -04:00
Kelvin Li
f50eaea8ce [flang] Add PowerPC vec_splat, vec_splats and vec_splat_s32 intrinsic
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>

Differential Revision: https://reviews.llvm.org/D157728
2023-08-14 16:15:28 -04:00
Kelvin Li
d9c2c6fcb1 [flang] Add PowerPC vec_stxvp and vsx_stxvp intrinsic
Differential Revision: https://reviews.llvm.org/D157768
2023-08-14 15:38:29 -04:00
Jie Fu
5a4171efdf [flang] Fix -Wstring-conversion in PPCIntrinsicCall.cpp (NFC)
/Users/jiefu/llvm-project/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp:1785:16: error: implicit conversion turns string literal into bool: 'const char[21]' to 'bool' [-Werror,-Wstring-conversion]
        assert("invalid element size");
        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
2023-08-11 07:56:01 +08:00
Kelvin Li
45c0053db2 [flang] Add a subset of PowerPC vector store intrinsics
This patch adds vec_st, vec_ste, vec_stxv, vec_xst, vec_xst_be, vec_xstd2
and vec_xstw4.

Differential Revision: https://reviews.llvm.org/D156333
2023-08-10 18:03:14 -04:00
Kelvin Li
d652884eb2 [flang] Add PowerPC vec_extract, vec_insert, vec_mergeh, vec_mergel, vec_perm and ver_permi intrinsic
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>
Co-authored-by: Mark Danial <Mark.Danial@ibm.com>

Differential Revision: https://reviews.llvm.org/D156197
2023-08-10 16:20:05 -04:00
Kelvin Li
facfbc9c4a [flang] Add PowerPC vec_cvbf16spn and vec_cvspbf16 intrinsic
Submit on behalf of Daniel Chen <cdchen@ca.ibm.com>

Differential Revision: https://reviews.llvm.org/D156243
2023-08-09 16:10:21 -04:00
Kelvin Li
00769d69fb [flang] Add -fppc-native-vector-element-order option to control the element order in PowerPC vector types
This patch also adds a LIT test for the vec_cvf intrinsic that
can be affected by the option.

Co-authored-by: Mark Danial <Mark.Danial@ibm.com>
Co-authored-by: Daniel Chen <cdchen@ca.ibm.com>

Differential Revision: https://reviews.llvm.org/D155852
2023-08-04 17:11:30 -04:00
Peter Klausler
ff56b7474f
[flang] Add two llvm_unreachable() calls to new code to silence compiler warning
This gets our -Werror build working again.

Differential Revision: https://reviews.llvm.org/D156745
2023-07-31 16:04:51 -07:00
Kelvin Li
2c2d427ca3 [flang] Add a subset of PowerPC MMA (Matrix Multiply Accelerate) intrinsics
This patch includes the a subset of MMA intrinsics that are included in
the mma intrinsic module:

mma_assemble_acc
mma_assemble_pair
mma_build_acc
mma_disassemble_acc
mma_disassemble_pair

Submit on behalf of Daniel Chen <cdchen@ca.ibm.com>

Differential Revision: https://reviews.llvm.org/D155725
2023-07-27 14:30:06 -04:00
Kelvin Li
447c3a358d [flang] Add PowerPC vec_abs, vec_nmadd, vec_msub and vec_sel intrinsics
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>

Differential Revision: https://reviews.llvm.org/D154985
2023-07-24 14:03:50 -04:00
Kelvin Li
99dc3935b9 [flang] Add PowerPC vec_convert, vec_ctf and vec_cvf intrinsic
Co-authored-by: Paul Scoropan <1paulscoropan@gmail.com>

Differential Revision: https://reviews.llvm.org/D155235
2023-07-19 22:27:55 -04:00
Kelvin Li
10124b3e1e [flang] Add PowerPC vec_sl, vec_sld, vec_sldw, vec_sll, vec_slo, vec_srl and vec_sro intrinsic
Co-authored-by: pscoro

Differential Revision: https://reviews.llvm.org/D154563
2023-07-12 17:39:13 -04:00
Kai Luo
fb09f9f914 [Flang] Use llvm_unreachable to replace assert, NFC
IIUC, the `default` case should be unreachable inferred from the context.

Reviewed By: kkwli0

Differential Revision: https://reviews.llvm.org/D154344
2023-07-04 15:05:37 +08:00
Kiran Chandramohan
06c3607a6e [Flang] Mark as maybe_unused to fix warning in PPCIntrinsicCall.cpp 2023-07-03 16:51:39 +00:00
Jie Fu
e4d6860d2d [flang] Fix -Wstring-conversion in PPCIntrinsicCall.cpp (NFC)
/Users/jiefu/llvm-project/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp:617:14: error: implicit conversion turns string literal into bool: 'const char[39]' to 'bool' [-Werror,-Wstring-conversion]
      assert("Invalid vector operation for generator");
      ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2023-07-03 14:14:48 +08:00
Kelvin Li
e435129ba9 [flang] Add PowerPC vec_cmpge, vec_cmpgt, vec_cmple, vec_cmplt and vec_any_ge intrinsic
Differential Revision: https://reviews.llvm.org/D154167
2023-07-03 00:14:51 -04:00
Kelvin Li
f295c88937 [flang] Add PPC vec_max, vec_min, vec_madd and vec_nmsub intrinsic
Differential Revision: https://reviews.llvm.org/D152938
2023-06-26 10:52:47 -04:00
Paul Scoropan
ce782ebdc7 [Flang] Split PowerPC-specific code out of IntrinsicCall into PPCIntrinsicCall
This patch moves PPC intrinsic generator code to PPCIntrinsicCall.cpp. In order to move PowerPC intrinsic code out of IntrinsicCall.cpp, we need to also move some declarations to IntrinsicCall.h. handlers[] and mathOperations[] were also chosen to be moved to the IntrinsicCall header. Similarly, ppcHandlers[] and ppcMathOperations[] were moved to the PPCIntrinsicCall header. There are future patches coming up that will introduce many new PPC intrinsics, these will now be defined in PPCIntrinsicCall.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D152460
2023-06-16 17:26:41 +00:00