-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AArch64][SME2] Add ldr_zt, str_zt builtins and intrinsics #72849
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_ldr_str_zt.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py | ||
|
||
// REQUIRES: aarch64-registered-target | ||
|
||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s | ||
MDevereau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK | ||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s | ||
|
||
#include <arm_sme_draft_spec_subject_to_change.h> | ||
|
||
// LDR ZT0 | ||
|
||
// CHECK-LABEL: @test_svldr_zt( | ||
// CHECK-NEXT: entry: | ||
// CHECK-NEXT: tail call void @llvm.aarch64.sme.ldr.zt(i32 0, ptr [[BASE:%.*]]) | ||
// CHECK-NEXT: ret void | ||
// | ||
// CPP-CHECK-LABEL: @_Z13test_svldr_ztPKv( | ||
// CPP-CHECK-NEXT: entry: | ||
// CPP-CHECK-NEXT: tail call void @llvm.aarch64.sme.ldr.zt(i32 0, ptr [[BASE:%.*]]) | ||
// CPP-CHECK-NEXT: ret void | ||
// | ||
void test_svldr_zt(const void *base) __arm_streaming_compatible __arm_shared_za __arm_preserves_za { | ||
svldr_zt(0, base); | ||
} | ||
|
||
|
||
// STR ZT0 | ||
|
||
// CHECK-LABEL: @test_svstr_zt( | ||
// CHECK-NEXT: entry: | ||
// CHECK-NEXT: tail call void @llvm.aarch64.sme.str.zt(i32 0, ptr [[BASE:%.*]]) | ||
// CHECK-NEXT: ret void | ||
// | ||
// CPP-CHECK-LABEL: @_Z13test_svstr_ztPv( | ||
// CPP-CHECK-NEXT: entry: | ||
// CPP-CHECK-NEXT: tail call void @llvm.aarch64.sme.str.zt(i32 0, ptr [[BASE:%.*]]) | ||
// CPP-CHECK-NEXT: ret void | ||
// | ||
void test_svstr_zt(void *base) __arm_streaming_compatible __arm_shared_za __arm_preserves_za { | ||
svstr_zt(0, base); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu \ | ||
// RUN: -target-feature +sve2 -target-feature +sme2 -target-feature +sme-i16i64 -target-feature +sme-f64f64 -fsyntax-only -verify %s | ||
|
||
// REQUIRES: aarch64-registered-target | ||
|
||
#include <arm_sme_draft_spec_subject_to_change.h> | ||
|
||
void test_ldr_str_zt(const void *const_base, void *base) __arm_streaming_compatible __arm_shared_za __arm_preserves_za { | ||
svldr_zt(1, const_base); // expected-error {{argument value 1 is outside the valid range [0, 0]}} | ||
svstr_zt(1, base); // expected-error {{argument value 1 is outside the valid range [0, 0]}} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -326,9 +326,14 @@ class AArch64DAGToDAGISel : public SelectionDAGISel { | |
return false; | ||
} | ||
|
||
template <unsigned BaseReg> bool ImmToTile(SDValue N, SDValue &Imm) { | ||
template <unsigned BaseReg, unsigned Max> | ||
bool ImmToTile(SDValue N, SDValue &Imm) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
if (auto *CI = dyn_cast<ConstantSDNode>(N)) { | ||
uint64_t C = CI->getZExtValue(); | ||
|
||
if (C > Max) | ||
return false; | ||
|
||
Imm = CurDAG->getRegister(BaseReg + C, MVT::Other); | ||
return true; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py | ||
; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sme2 -verify-machineinstrs < %s | FileCheck %s | ||
|
||
; LDR | ||
|
||
define void @ldr_zt0(ptr %ptr) { | ||
; CHECK-LABEL: ldr_zt0: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: ldr zt0, [x0] | ||
; CHECK-NEXT: ret | ||
call void @llvm.aarch64.sme.ldr.zt(i32 0, ptr %ptr) | ||
ret void; | ||
} | ||
|
||
; STR | ||
|
||
define void @str_zt0(ptr %ptr) { | ||
; CHECK-LABEL: str_zt0: | ||
; CHECK: // %bb.0: | ||
; CHECK-NEXT: str zt0, [x0] | ||
; CHECK-NEXT: ret | ||
call void @llvm.aarch64.sme.str.zt(i32 0, ptr %ptr) | ||
ret void; | ||
} | ||
|
||
declare void @llvm.aarch64.sme.ldr.zt(i32, ptr) | ||
declare void @llvm.aarch64.sme.str.zt(i32, ptr) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed this after you landed it, but LDR does not preserve ZT0 because it's currently modelled as part of ZA.
This will be modelled differently with ARM-software/acle#276, but it would be good to fix the attribute for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've opened #74303 to fix this