Files
TheRock/compiler/amd-llvm/compiler-rt/test/builtins/Unit/ppc/fixunstfti_test.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

54 lines
1.8 KiB
C

// UNSUPPORTED: target-is-powerpc64le
// REQUIRES: target-is-powerpc64le
// RUN: %clang_builtins %s %librt -o %t && %run %t
#include <stdint.h>
#include <stdio.h>
#include "fixunstfti_test.h"
/* The long double representation, with the high and low portions of
* the long double, and the corresponding bit patterns of each double. */
typedef union {
long double ld;
double d[2]; /* [0] is the high double, [1] is the low double. */
unsigned long long ull[2]; /* High and low doubles as 64-bit integers. */
} ldUnion;
__uint128_t __fixunstfti(long double);
int main(int argc, char *argv[]) {
/* Necessary long double and (unsigned) 128 bit integer
* declarations used to compare the computed and expected results
* from converting the IBM double-double to int128. */
ldUnion ldInput;
__uint128_t expectedResult, computedResult;
for (int i = 0; i < numTests; ++i) {
/* Set the expected 128 bit integer and the high and low
* values of the long double input. */
ldInput.d[0] = testList[i].hiInput;
ldInput.d[1] = testList[i].loInput;
expectedResult = testList[i].result128;
/* Get the computed 128 bit integer from the long double->
* uint128 conversion, and check for errors between results. */
computedResult = __fixunstfti(ldInput.ld);
if (computedResult != expectedResult) {
printf("Error for __fixunstfti at input %La = ( %a , %a ):\n", ldInput.ld,
ldInput.d[0], ldInput.d[1]);
printf("\tExpected __uint128_t: 0x%016llx 0x%016llx\n",
(unsigned long long)(expectedResult >> 64),
(unsigned long long)expectedResult);
printf("\tComputed __uint128_t: 0x%016llx 0x%016llx\n\n",
(unsigned long long)(computedResult >> 64),
(unsigned long long)computedResult);
return 1;
}
}
return 0;
}