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.
Reapply "[clang] Support fixed point types in C++ (llvm#67750)" (llvm…
- Loading branch information
Showing
7 changed files
with
131 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// RUN: %clang_cc1 -ffixed-point -S -emit-llvm %s -o - -triple=x86_64-unknown-linux-gnu | FileCheck %s | ||
|
||
// Primary fixed point types | ||
void func(signed short _Accum){} // CHECK: @_Z4funcDAs | ||
void func(signed _Accum){} // CHECK: @_Z4funcDAi | ||
void func(signed long _Accum){} // CHECK: @_Z4funcDAl | ||
void func(unsigned short _Accum){} // CHECK: @_Z4funcDAt | ||
void func(unsigned _Accum){} // CHECK: @_Z4funcDAj | ||
void func(unsigned long _Accum){} // CHECK: @_Z4funcDAm | ||
void func(signed short _Fract){} // CHECK: @_Z4funcDRs | ||
void func(signed _Fract){} // CHECK: @_Z4funcDRi | ||
void func(signed long _Fract){} // CHECK: @_Z4funcDRl | ||
void func(unsigned short _Fract){} // CHECK: @_Z4funcDRt | ||
void func(unsigned _Fract){} // CHECK: @_Z4funcDRj | ||
void func(unsigned long _Fract){} // CHECK: @_Z4funcDRm | ||
|
||
// Aliased | ||
void func2(short _Accum){} // CHECK: @_Z5func2DAs | ||
void func2(_Accum){} // CHECK: @_Z5func2DAi | ||
void func2(long _Accum){} // CHECK: @_Z5func2DAl | ||
void func2(short _Fract){} // CHECK: @_Z5func2DRs | ||
void func2(_Fract){} // CHECK: @_Z5func2DRi | ||
void func2(long _Fract){} // CHECK: @_Z5func2DRl | ||
|
||
// Primary saturated | ||
void func(_Sat signed short _Accum){} // CHECK: @_Z4funcDSDAs | ||
void func(_Sat signed _Accum){} // CHECK: @_Z4funcDSDAi | ||
void func(_Sat signed long _Accum){} // CHECK: @_Z4funcDSDAl | ||
void func(_Sat unsigned short _Accum){} // CHECK: @_Z4funcDSDAt | ||
void func(_Sat unsigned _Accum){} // CHECK: @_Z4funcDSDAj | ||
void func(_Sat unsigned long _Accum){} // CHECK: @_Z4funcDSDAm | ||
void func(_Sat signed short _Fract){} // CHECK: @_Z4funcDSDRs | ||
void func(_Sat signed _Fract){} // CHECK: @_Z4funcDSDRi | ||
void func(_Sat signed long _Fract){} // CHECK: @_Z4funcDSDRl | ||
void func(_Sat unsigned short _Fract){} // CHECK: @_Z4funcDSDRt | ||
void func(_Sat unsigned _Fract){} // CHECK: @_Z4funcDSDRj | ||
void func(_Sat unsigned long _Fract){} // CHECK: @_Z4funcDSDRm | ||
|
||
// Aliased saturated | ||
void func2(_Sat short _Accum){} // CHECK: @_Z5func2DSDAs | ||
void func2(_Sat _Accum){} // CHECK: @_Z5func2DSDAi | ||
void func2(_Sat long _Accum){} // CHECK: @_Z5func2DSDAl | ||
void func2(_Sat short _Fract){} // CHECK: @_Z5func2DSDRs | ||
void func2(_Sat _Fract){} // CHECK: @_Z5func2DSDRi | ||
void func2(_Sat long _Fract){} // CHECK: @_Z5func2DSDRl |
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 |
---|---|---|
@@ -1,14 +1,16 @@ | ||
// RUN: %clang_cc1 -x c++ %s -verify | ||
// RUN: %clang_cc1 -x c++ -ffixed-point %s -verify | ||
|
||
// Name namgling is not provided for fixed point types in c++ | ||
// RUN: %clang_cc1 -x c++ %s -verify -DWITHOUT_FIXED_POINT | ||
// RUN: %clang_cc1 -x c++ %s -verify -ffixed-point | ||
|
||
#ifdef WITHOUT_FIXED_POINT | ||
_Accum accum; // expected-error{{unknown type name '_Accum'}} | ||
_Fract fract; // expected-error{{unknown type name '_Fract'}} | ||
_Sat _Accum sat_accum; // expected-error{{unknown type name '_Sat'}} | ||
// expected-error@-1{{expected ';' after top level declarator}} | ||
#endif | ||
|
||
int accum_int = 10k; // expected-error{{invalid suffix 'k' on integer constant}} | ||
int fract_int = 10r; // expected-error{{invalid suffix 'r' on integer constant}} | ||
float accum_flt = 10.0k; // expected-error{{invalid suffix 'k' on floating constant}} | ||
float fract_flt = 10.0r; // expected-error{{invalid suffix 'r' on floating constant}} | ||
#ifdef WITHOUT_FIXED_POINT | ||
float accum_flt = 0.0k; // expected-error{{invalid suffix 'k' on floating constant}} | ||
float fract_flt = 0.0r; // expected-error{{invalid suffix 'r' on floating constant}} | ||
#endif |