-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CIR] Add initial support for bit-precise integer types (#538)
This PR adds initial support for the bit-precise integer type `_BitInt(N)`. This type goes into the C23 standard, and has already been supported by clang since 2020, previously known as `_ExtInt(N)`. This PR is quite simple and straight-forward. Basically it leverages the existing `cir.int` type to represent such types. Previously `cir.int` verifies that its width must be a multiple of 8, and this verification has been removed in this PR.
- Loading branch information
Showing
11 changed files
with
208 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir | ||
// RUN: FileCheck --input-file=%t.cir %s | ||
|
||
void VLATest(_BitInt(3) A, _BitInt(42) B, _BitInt(17) C) { | ||
int AR1[A]; | ||
int AR2[B]; | ||
int AR3[C]; | ||
} | ||
|
||
// CHECK: cir.func @VLATest | ||
// CHECK: %[[#A:]] = cir.load %{{.+}} : cir.ptr <!cir.int<s, 3>>, !cir.int<s, 3> | ||
// CHECK-NEXT: %[[#A_PROMOTED:]] = cir.cast(integral, %[[#A]] : !cir.int<s, 3>), !u64i | ||
// CHECK-NEXT: %[[#SP:]] = cir.stack_save : !cir.ptr<!u8i> | ||
// CHECK-NEXT: cir.store %[[#SP]], %{{.+}} : !cir.ptr<!u8i>, cir.ptr <!cir.ptr<!u8i>> | ||
// CHECK-NEXT: %{{.+}} = cir.alloca !s32i, cir.ptr <!s32i>, %[[#A_PROMOTED]] : !u64i | ||
// CHECK-NEXT: %[[#B:]] = cir.load %1 : cir.ptr <!cir.int<s, 42>>, !cir.int<s, 42> | ||
// CHECK-NEXT: %[[#B_PROMOTED:]] = cir.cast(integral, %[[#B]] : !cir.int<s, 42>), !u64i | ||
// CHECK-NEXT: %{{.+}} = cir.alloca !s32i, cir.ptr <!s32i>, %[[#B_PROMOTED]] : !u64i | ||
// CHECK-NEXT: %[[#C:]] = cir.load %2 : cir.ptr <!cir.int<s, 17>>, !cir.int<s, 17> | ||
// CHECK-NEXT: %[[#C_PROMOTED:]] = cir.cast(integral, %[[#C]] : !cir.int<s, 17>), !u64i | ||
// CHECK-NEXT: %{{.+}} = cir.alloca !s32i, cir.ptr <!s32i>, %[[#C_PROMOTED]] : !u64i | ||
// CHECK: } |
Oops, something went wrong.