Files
TheRock/compiler/amd-llvm/clang/test/CodeGen/LoongArch/bitint.c
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

123 lines
6.0 KiB
C

// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
// RUN: %clang_cc1 -triple loongarch32 -fexperimental-max-bitint-width=1024 -emit-llvm %s -o - | FileCheck %s --check-prefix=LA32
// RUN: %clang_cc1 -triple loongarch64 -fexperimental-max-bitint-width=1024 -emit-llvm %s -o - | FileCheck %s --check-prefix=LA64
/// Testing the alignment and size of _BitInt(N) for different values of N.
void pass_BitInt7(_BitInt(7));
void pass_BitInt65(_BitInt(65));
void pass_BitInt129(_BitInt(129));
// LA32-LABEL: define dso_local void @example_BitInt(
// LA32-SAME: ) #[[ATTR0:[0-9]+]] {
// LA32-NEXT: [[ENTRY:.*:]]
// LA32-NEXT: [[L7:%.*]] = alloca i8, align 1
// LA32-NEXT: [[L65:%.*]] = alloca i128, align 16
// LA32-NEXT: [[L129:%.*]] = alloca [32 x i8], align 16
// LA32-NEXT: [[BYVAL_TEMP:%.*]] = alloca i128, align 16
// LA32-NEXT: [[BYVAL_TEMP3:%.*]] = alloca [32 x i8], align 16
// LA32-NEXT: store i8 0, ptr [[L7]], align 1
// LA32-NEXT: store i128 0, ptr [[L65]], align 16
// LA32-NEXT: store i256 0, ptr [[L129]], align 16
// LA32-NEXT: [[TMP0:%.*]] = load i8, ptr [[L7]], align 1
// LA32-NEXT: [[LOADEDV:%.*]] = trunc i8 [[TMP0]] to i7
// LA32-NEXT: call void @pass_BitInt7(i7 noundef signext [[LOADEDV]])
// LA32-NEXT: [[TMP1:%.*]] = load i128, ptr [[L65]], align 16
// LA32-NEXT: [[LOADEDV1:%.*]] = trunc i128 [[TMP1]] to i65
// LA32-NEXT: [[STOREDV:%.*]] = sext i65 [[LOADEDV1]] to i128
// LA32-NEXT: store i128 [[STOREDV]], ptr [[BYVAL_TEMP]], align 16
// LA32-NEXT: call void @pass_BitInt65(ptr noundef dead_on_return [[BYVAL_TEMP]])
// LA32-NEXT: [[TMP2:%.*]] = load i256, ptr [[L129]], align 16
// LA32-NEXT: [[LOADEDV2:%.*]] = trunc i256 [[TMP2]] to i129
// LA32-NEXT: [[STOREDV4:%.*]] = sext i129 [[LOADEDV2]] to i256
// LA32-NEXT: store i256 [[STOREDV4]], ptr [[BYVAL_TEMP3]], align 16
// LA32-NEXT: call void @pass_BitInt129(ptr noundef dead_on_return [[BYVAL_TEMP3]])
// LA32-NEXT: ret void
//
// LA64-LABEL: define dso_local void @example_BitInt(
// LA64-SAME: ) #[[ATTR0:[0-9]+]] {
// LA64-NEXT: [[ENTRY:.*:]]
// LA64-NEXT: [[L7:%.*]] = alloca i8, align 1
// LA64-NEXT: [[L65:%.*]] = alloca i128, align 16
// LA64-NEXT: [[L129:%.*]] = alloca i256, align 16
// LA64-NEXT: [[BYVAL_TEMP:%.*]] = alloca i256, align 16
// LA64-NEXT: store i8 0, ptr [[L7]], align 1
// LA64-NEXT: store i128 0, ptr [[L65]], align 16
// LA64-NEXT: store i256 0, ptr [[L129]], align 16
// LA64-NEXT: [[TMP0:%.*]] = load i8, ptr [[L7]], align 1
// LA64-NEXT: [[LOADEDV:%.*]] = trunc i8 [[TMP0]] to i7
// LA64-NEXT: call void @pass_BitInt7(i7 noundef signext [[LOADEDV]])
// LA64-NEXT: [[TMP1:%.*]] = load i128, ptr [[L65]], align 16
// LA64-NEXT: [[LOADEDV1:%.*]] = trunc i128 [[TMP1]] to i65
// LA64-NEXT: call void @pass_BitInt65(i65 noundef [[LOADEDV1]])
// LA64-NEXT: [[TMP2:%.*]] = load i256, ptr [[L129]], align 16
// LA64-NEXT: [[LOADEDV2:%.*]] = trunc i256 [[TMP2]] to i129
// LA64-NEXT: [[STOREDV:%.*]] = sext i129 [[LOADEDV2]] to i256
// LA64-NEXT: store i256 [[STOREDV]], ptr [[BYVAL_TEMP]], align 16
// LA64-NEXT: call void @pass_BitInt129(ptr noundef dead_on_return [[BYVAL_TEMP]])
// LA64-NEXT: ret void
//
void example_BitInt(void) {
_BitInt(7) l7 = {0};
_BitInt(65) l65 = {0};
_BitInt(129) l129 = {0};
pass_BitInt7(l7);
pass_BitInt65(l65);
pass_BitInt129(l129);
}
// LA32-LABEL: define dso_local signext i7 @return_large_BitInt7(
// LA32-SAME: ) #[[ATTR0]] {
// LA32-NEXT: [[ENTRY:.*:]]
// LA32-NEXT: ret i7 0
//
// LA64-LABEL: define dso_local signext i7 @return_large_BitInt7(
// LA64-SAME: ) #[[ATTR0]] {
// LA64-NEXT: [[ENTRY:.*:]]
// LA64-NEXT: ret i7 0
//
_BitInt(7) return_large_BitInt7(void) { return 0; }
// LA32-LABEL: define dso_local void @return_large_BitInt65(
// LA32-SAME: ptr dead_on_unwind noalias writable sret(i128) align 16 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
// LA32-NEXT: [[ENTRY:.*:]]
// LA32-NEXT: [[RESULT_PTR:%.*]] = alloca ptr, align 4
// LA32-NEXT: store ptr [[AGG_RESULT]], ptr [[RESULT_PTR]], align 4
// LA32-NEXT: store i128 0, ptr [[AGG_RESULT]], align 16
// LA32-NEXT: [[TMP0:%.*]] = load i128, ptr [[AGG_RESULT]], align 16
// LA32-NEXT: [[LOADEDV:%.*]] = trunc i128 [[TMP0]] to i65
// LA32-NEXT: [[STOREDV:%.*]] = sext i65 [[LOADEDV]] to i128
// LA32-NEXT: store i128 [[STOREDV]], ptr [[AGG_RESULT]], align 16
// LA32-NEXT: ret void
//
// LA64-LABEL: define dso_local i65 @return_large_BitInt65(
// LA64-SAME: ) #[[ATTR0]] {
// LA64-NEXT: [[ENTRY:.*:]]
// LA64-NEXT: ret i65 0
//
_BitInt(65) return_large_BitInt65(void) { return 0; }
// LA32-LABEL: define dso_local void @return_large_BitInt129(
// LA32-SAME: ptr dead_on_unwind noalias writable sret([32 x i8]) align 16 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
// LA32-NEXT: [[ENTRY:.*:]]
// LA32-NEXT: [[RESULT_PTR:%.*]] = alloca ptr, align 4
// LA32-NEXT: store ptr [[AGG_RESULT]], ptr [[RESULT_PTR]], align 4
// LA32-NEXT: store i256 0, ptr [[AGG_RESULT]], align 16
// LA32-NEXT: [[TMP0:%.*]] = load i256, ptr [[AGG_RESULT]], align 16
// LA32-NEXT: [[LOADEDV:%.*]] = trunc i256 [[TMP0]] to i129
// LA32-NEXT: [[STOREDV:%.*]] = sext i129 [[LOADEDV]] to i256
// LA32-NEXT: store i256 [[STOREDV]], ptr [[AGG_RESULT]], align 16
// LA32-NEXT: ret void
//
// LA64-LABEL: define dso_local void @return_large_BitInt129(
// LA64-SAME: ptr dead_on_unwind noalias writable sret(i256) align 16 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
// LA64-NEXT: [[ENTRY:.*:]]
// LA64-NEXT: [[RESULT_PTR:%.*]] = alloca ptr, align 8
// LA64-NEXT: store ptr [[AGG_RESULT]], ptr [[RESULT_PTR]], align 8
// LA64-NEXT: store i256 0, ptr [[AGG_RESULT]], align 16
// LA64-NEXT: [[TMP0:%.*]] = load i256, ptr [[AGG_RESULT]], align 16
// LA64-NEXT: [[LOADEDV:%.*]] = trunc i256 [[TMP0]] to i129
// LA64-NEXT: [[STOREDV:%.*]] = sext i129 [[LOADEDV]] to i256
// LA64-NEXT: store i256 [[STOREDV]], ptr [[AGG_RESULT]], align 16
// LA64-NEXT: ret void
//
_BitInt(129) return_large_BitInt129(void) { return 0; }