[PATCH] D155612: [RISCV] Add test which shows alignment of constant pools and the functions which followed

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 08:43:03 PDT 2023


reames created this revision.
reames added reviewers: craig.topper, luke, asb, frasercrmck, kito-cheng.
Herald added subscribers: jobnoorman, VincentWu, vkmr, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, niosHD, sabuasal, bollu, simoncook, johnrusso, rbar, arichardson, mcrosier.
Herald added a project: All.
reames requested review of this revision.
Herald added subscribers: wangpc, eopXD, MaskRay.
Herald added a project: LLVM.

See next change in stack for context.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155612

Files:
  llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll


Index: llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/RISCV/rvv/fixed-vectors-constant-pool-alignment.ll
@@ -0,0 +1,46 @@
+; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s
+
+define void @constantpool_v16xi8(ptr %x) {
+; CHECK: .section	.rodata.cst16,"aM", at progbits,16
+; CHECK: .p2align	4, 0x0
+; CHECK: .byte
+; CHECK: .globl	constantpool_v16xi8
+; CHECK: .p2align	2
+  store <16 x i8> <i8 0, i8 1, i8 3, i8 3, i8 4, i8 5, i8 15, i8 7, i8 27, i8 9, i8 10, i8 11, i8 12, i8 13, i8 12, i8 15>, ptr %x
+  ret void
+}
+
+define void @constantpool_v4xi32(ptr %x) {
+; CHECK: .section	.rodata.cst16,"aM", at progbits,16
+; CHECK: .p2align	4, 0x0
+; CHECK: .word
+; CHECK: .globl	constantpool_v4xi32
+; CHECK: .p2align	2
+  store <4 x i32> <i32 -27, i32 255, i32 3, i32 63>, ptr %x
+  ret void
+}
+
+; Note that to exercise the 64 bit alignment case, we need four elements
+; as all of the two element small constant cases get optimized to some
+; other sequence
+define void @constantpool_v4xi64(ptr %x) {
+; CHECK: .section	.rodata.cst32,"aM", at progbits,32
+; CHECK: .p2align	5, 0x0
+; CHECK: .quad
+; CHECK: .globl	constantpool_v4xi64
+; CHECK: .p2align	2
+  store <4 x i64> <i64 -27, i64 255, i64 3, i64 63>, ptr %x
+  ret void
+}
+
+define void @constantpool_i64(ptr %x) {
+; CHECK: .section	.sdata,"aw", at progbits
+; CHECK: .p2align	3
+; CHECK: .quad	58373358938439
+; CHECK: .globl	constantpool_i64
+; CHECK: .p2align	2
+  store i64 58373358938439, ptr %x
+  ret void
+}
+
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155612.541569.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230718/268d0364/attachment.bin>


More information about the llvm-commits mailing list