Skip to content

[AArch64] Add tests for fused FP literals. NFC #106731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

citymarina
Copy link
Contributor

This is for an upcoming change to the threshold on Apple targets for using a constant pool for FP literals versus building them with integer moves.

This file is based on literal_pools_float.ll. I tried to bolt on to the existing test, but it got messy as that file is already testing a matrix of combinations, so creating this new file instead.

This is for an upcoming change to the threshold on Apple targets
for using a constant pool for FP literals versus building them with
integer moves.

This file is based on literal_pools_float.ll. I tried to bolt on to
the existing test, but it got messy as that file is already testing
a matrix of combinations, so creating this new file instead.
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2024

@llvm/pr-subscribers-backend-aarch64

Author: Marina Taylor (citymarina)

Changes

This is for an upcoming change to the threshold on Apple targets for using a constant pool for FP literals versus building them with integer moves.

This file is based on literal_pools_float.ll. I tried to bolt on to the existing test, but it got messy as that file is already testing a matrix of combinations, so creating this new file instead.


Full diff: https://github.com/llvm/llvm-project/pull/106731.diff

1 Files Affected:

  • (added) llvm/test/CodeGen/AArch64/literal_pools_float_apple.ll (+128)
diff --git a/llvm/test/CodeGen/AArch64/literal_pools_float_apple.ll b/llvm/test/CodeGen/AArch64/literal_pools_float_apple.ll
new file mode 100644
index 00000000000000..144f71ab1e4695
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/literal_pools_float_apple.ll
@@ -0,0 +1,128 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s
+; RUN: llc -verify-machineinstrs -mtriple=arm64-apple-macosx -mcpu=apple-m1 < %s | FileCheck %s --check-prefix=APPLE
+
+define dso_local float @float_0mov() {
+; CHECK-LABEL: float_0mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    fmov s0, #1.00000000
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: float_0mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    fmov s0, #1.00000000
+; APPLE-NEXT:    ret
+  ret float 1.0
+}
+
+define dso_local float @float_1mov() {
+; CHECK-LABEL: float_1mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    mov w8, #2143289344 // =0x7fc00000
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: float_1mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov w8, #2143289344 ; =0x7fc00000
+; APPLE-NEXT:    fmov s0, w8
+; APPLE-NEXT:    ret
+  ret float 0x7FF8000000000000
+}
+
+define dso_local float @float_2mov() {
+; CHECK-LABEL: float_2mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    mov w8, #34952 // =0x8888
+; CHECK-NEXT:    movk w8, #32704, lsl #16
+; CHECK-NEXT:    fmov s0, w8
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: float_2mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov w8, #34952 ; =0x8888
+; APPLE-NEXT:    movk w8, #32704, lsl #16
+; APPLE-NEXT:    fmov s0, w8
+; APPLE-NEXT:    ret
+  ret float 0x7FF8111100000000
+}
+
+define dso_local double @double_0mov() {
+; CHECK-LABEL: double_0mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    fmov d0, #1.00000000
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: double_0mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    fmov d0, #1.00000000
+; APPLE-NEXT:    ret
+  ret double 1.0
+}
+
+define dso_local double @double_1mov() {
+; CHECK-LABEL: double_1mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    mov x8, #4096 // =0x1000
+; CHECK-NEXT:    fmov d0, x8
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: double_1mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov x8, #4096 ; =0x1000
+; APPLE-NEXT:    fmov d0, x8
+; APPLE-NEXT:    ret
+  ret double 0x1000
+}
+
+define dso_local double @double_2mov() {
+; CHECK-LABEL: double_2mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    mov x8, #4096 // =0x1000
+; CHECK-NEXT:    movk x8, #8192, lsl #16
+; CHECK-NEXT:    fmov d0, x8
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: double_2mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov x8, #4096 ; =0x1000
+; APPLE-NEXT:    movk x8, #8192, lsl #16
+; APPLE-NEXT:    fmov d0, x8
+; APPLE-NEXT:    ret
+  ret double 0x20001000
+}
+
+define dso_local double @double_3mov() {
+; CHECK-LABEL: double_3mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    adrp x8, .LCPI6_0
+; CHECK-NEXT:    ldr d0, [x8, :lo12:.LCPI6_0]
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: double_3mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov x8, #4096 ; =0x1000
+; APPLE-NEXT:    movk x8, #8192, lsl #16
+; APPLE-NEXT:    movk x8, #12288, lsl #32
+; APPLE-NEXT:    fmov d0, x8
+; APPLE-NEXT:    ret
+  ret double 0x300020001000
+}
+
+define dso_local double @double_4mov() {
+; CHECK-LABEL: double_4mov:
+; CHECK:       // %bb.0:
+; CHECK-NEXT:    adrp x8, .LCPI7_0
+; CHECK-NEXT:    ldr d0, [x8, :lo12:.LCPI7_0]
+; CHECK-NEXT:    ret
+;
+; APPLE-LABEL: double_4mov:
+; APPLE:       ; %bb.0:
+; APPLE-NEXT:    mov x8, #4096 ; =0x1000
+; APPLE-NEXT:    movk x8, #8192, lsl #16
+; APPLE-NEXT:    movk x8, #12288, lsl #32
+; APPLE-NEXT:    movk x8, #16384, lsl #48
+; APPLE-NEXT:    fmov d0, x8
+; APPLE-NEXT:    ret
+  ret double 0x4000300020001000
+}

@fhahn fhahn requested a review from ahmedbougacha August 30, 2024 14:45
fhahn added a commit that referenced this pull request Sep 1, 2024
Implement cost computation for VPWidenCallRecipe. In some cases, targets
use argument info to compute intrinsic costs. If all operands of the
call are VPValues with an underlying IR value, use the IR values as
arguments.

PR: #106731
Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fhahn fhahn merged commit 747d89a into llvm:main Sep 1, 2024
6 of 8 checks passed
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Sep 3, 2024
Implement cost computation for VPWidenCallRecipe. In some cases, targets
use argument info to compute intrinsic costs. If all operands of the
call are VPValues with an underlying IR value, use the IR values as
arguments.

PR: llvm#106731

Change-Id: I9eea7ea07341d8662d5cb0798dcb7151f0fb04e2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants