forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP][CLANG][AArch64] Add the modal 8 bit floating-point scalar type
ARM ACLE PR#323[1] adds new modal types for 8-bit floating point intrinsic. From the PR#323: ``` ACLE defines the `__fpm8` type, which can be used for the E5M2 and E4M3 8-bit floating-point formats. It is a storage and interchange only type with no arithmetic operations other than intrinsic calls. ```` The type should be an opaque type and its format in undefined in Clang. Only defined in the backend by a status/format register, for AArch64 the FPMR. This patch is an attempt to the add the fpm8_t scalar type. It has a parser and codegen for the new scalar type. The patch it is lowering to and 8bit unsigned as it has no format. But maybe we should add another opaque type. [1] ARM-software/acle#323
- Loading branch information
1 parent
9e63632
commit fbeca5c
Showing
25 changed files
with
171 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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,91 @@ | ||
// RUN: %clang_cc1 -std=c++11 -ast-dump %s | FileCheck %s --strict-whitespace | ||
|
||
/* Various contexts where type __fpm8 can appear. */ | ||
|
||
/* Namespace */ | ||
namespace { | ||
__fpm8 f2n; | ||
__fpm8 arr1n[10]; | ||
} | ||
|
||
//CHECK: |-NamespaceDecl {{.*}} | ||
//CHECK-NEXT: | |-VarDecl {{.*}} f2n '__fpm8' | ||
//CHECK-NEXT: | `-VarDecl {{.*}} arr1n '__fpm8[10]' | ||
|
||
__fpm8 arr1[10]; | ||
//__fpm8 arr2n[] { 1, 3, 3 }; cannot initialize | ||
|
||
const __fpm8 func1n(const __fpm8 fpm8) { | ||
// this should fail | ||
__fpm8 f1n; | ||
f1n = fpm8; | ||
return f1n; | ||
} | ||
|
||
//CHECK: |-VarDecl {{.*}} '__fpm8[10]' | ||
|
||
//CHECK: | `-VarDecl {{.*}} f1n '__fpm8' | ||
//CHECK-NEXT: |-BinaryOperator {{.*}} '__fpm8' lvalue '=' | ||
//CHECK-NEXT: | |-DeclRefExpr {{.*}} '__fpm8' lvalue Var {{.*}} 'f1n' '__fpm8' | ||
//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: | `-DeclRefExpr {{.*}} 'const __fpm8' lvalue ParmVar {{.*}} 'fpm8' 'const __fpm8' | ||
//CHECK-NEXT: `-ReturnStmt {{.*}} | ||
//CHECK-NEXT: `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: `-DeclRefExpr {{.*}} '__fpm8' lvalue Var {{.*}} 'f1n' '__fpm8' | ||
|
||
|
||
/* Class */ | ||
|
||
class C1 { | ||
__fpm8 f1c; | ||
static const __fpm8 f2c; | ||
volatile __fpm8 f3c; | ||
public: | ||
C1(__fpm8 arg) : f1c(arg), f3c(arg) { } | ||
__fpm8 func1c(__fpm8 arg ) { | ||
return arg; | ||
} | ||
static __fpm8 func2c(__fpm8 arg) { | ||
return arg; | ||
} | ||
}; | ||
|
||
//CHECK: | |-CXXRecordDecl {{.*}} referenced class C1 | ||
//CHECK-NEXT: | |-FieldDecl {{.*}} f1c '__fpm8' | ||
//CHECK-NEXT: | |-VarDecl {{.*}} f2c 'const __fpm8' static | ||
//CHECK-NEXT: | |-FieldDecl {{.*}} f3c 'volatile __fpm8' | ||
//CHECK-NEXT: | |-AccessSpecDecl {{.*}} | ||
//CHECK-NEXT: | |-CXXConstructorDecl {{.*}} C1 'void (__fpm8)' implicit-inline | ||
//CHECK-NEXT: | | |-ParmVarDecl {{.*}} arg '__fpm8' | ||
//CHECK-NEXT: | | |-CXXCtorInitializer {{.*}} 'f1c' '__fpm8' | ||
//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '__fpm8' lvalue ParmVar {{.*}} 'arg' '__fpm8' | ||
//CHECK-NEXT: | | |-CXXCtorInitializer {{.*}} 'f3c' 'volatile __fpm8' | ||
//CHECK-NEXT: | | | `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: | | | `-DeclRefExpr {{.*}} '__fpm8' lvalue ParmVar {{.*}} 'arg' '__fpm8' | ||
//CHECK-NEXT: | | `-CompoundStmt {{.*}} | ||
//CHECK-NEXT: | |-CXXMethodDecl {{.*}} func1c '__fpm8 (__fpm8)' implicit-inline | ||
//CHECK-NEXT: | | |-ParmVarDecl {{.*}} arg '__fpm8' | ||
//CHECK-NEXT: | | `-CompoundStmt {{.*}} | ||
//CHECK-NEXT: | | `-ReturnStmt {{.*}} | ||
//CHECK-NEXT: | | `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: | | `-DeclRefExpr {{.*}} '__fpm8' lvalue ParmVar {{.*}}8 'arg' '__fpm8' | ||
//CHECK-NEXT: | `-CXXMethodDecl {{.*}} func2c '__fpm8 (__fpm8)' static implicit-inline | ||
//CHECK-NEXT: | |-ParmVarDecl {{.*}} arg '__fpm8' | ||
//CHECK-NEXT: | `-CompoundStmt {{.*}} | ||
//CHECK-NEXT: | `-ReturnStmt {{.*}} | ||
//CHECK-NEXT: | `-ImplicitCastExpr {{.*}} '__fpm8' <LValueToRValue> | ||
//CHECK-NEXT: | `-DeclRefExpr {{.*}} '__fpm8' lvalue ParmVar {{.*}} 'arg' '__fpm8' | ||
|
||
template <class C> struct S1 { | ||
C mem1; | ||
}; | ||
|
||
template <> struct S1<__fpm8> { | ||
__fpm8 mem2; | ||
}; | ||
|
||
//CHECK: |-TemplateArgument type '__fpm8' | ||
//CHECK-NEXT: | `-BuiltinType {{.*}} '__fpm8' | ||
//CHECK-NEXT: |-CXXRecordDecl {{.*}} implicit struct S1 | ||
//CHECK-NEXT: `-FieldDecl {{.*}} mem2 '__fpm8' |
Oops, something went wrong.