CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
50 lines
2.2 KiB
C
50 lines
2.2 KiB
C
/* RUN: %clang_cc1 -std=c89 -triple x86_64-pc-win32 -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c89 -triple i686-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c99 -triple x86_64-pc-win32 -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c99 -triple i686-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c11 -triple x86_64-pc-win32 -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c11 -triple i686-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c17 -triple x86_64-pc-win32 -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c17 -triple i686-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c2x -triple x86_64-pc-win32 -emit-llvm -o - %s | FileCheck %s
|
|
RUN: %clang_cc1 -std=c2x -triple i686-pc-linux -emit-llvm -o - %s | FileCheck %s
|
|
*/
|
|
|
|
/* WG14 DR335: yes
|
|
* _Bool bit-fields
|
|
*
|
|
* This validates the runtime behavior from the DR, see dr3xx.c for the compile
|
|
* time enforcement portion.
|
|
*/
|
|
void dr335(void) {
|
|
struct bits_ {
|
|
_Bool bbf1 : 1;
|
|
} bits = { 1 };
|
|
|
|
bits.bbf1 = ~bits.bbf1;
|
|
|
|
// First, load the value from bits.bbf1 and truncate it down to one-bit.
|
|
|
|
// CHECK: %[[LOAD1:.+]] = load i8, ptr {{.+}}, align 1
|
|
// CHECK-NEXT: %[[CLEAR1:.+]] = and i8 %[[LOAD1]], 1
|
|
// CHECK-NEXT: %[[CAST:.+]] = trunc i8 %[[CLEAR1]] to i1
|
|
// CHECK-NEXT: %[[CONV:.+]] = zext i1 %[[CAST]] to i32
|
|
|
|
// Second, perform the unary complement.
|
|
|
|
// CHECK-NEXT: %[[NOT:.+]] = xor i32 %[[CONV]], -1
|
|
|
|
// Finally, test the new value against 0. If it's nonzero, then assign one
|
|
// into the bit-field, otherwise assign zero into the bit-field. Note, this
|
|
// does not perform the operation on the promoted value, so this matches the
|
|
// requirements in C99 6.3.1.2, so a bit-field of type _Bool behaves like a
|
|
// _Bool and not like an [unsigned] int.
|
|
// CHECK-NEXT: %[[TOBOOL:.+]] = icmp ne i32 %[[NOT]], 0
|
|
// CHECK-NEXT: %[[ZERO:.+]] = zext i1 %[[TOBOOL]] to i8
|
|
// CHECK-NEXT: %[[LOAD2:.+]] = load i8, ptr {{.+}}, align 1
|
|
// CHECK-NEXT: %[[CLEAR2:.+]] = and i8 %[[LOAD2]], -2
|
|
// CHECK-NEXT: %[[SET:.+]] = or i8 %[[CLEAR2]], %[[ZERO]]
|
|
// CHECK-NEXT: store i8 %[[SET]], ptr {{.+}}, align 1
|
|
}
|
|
|