brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · f874d6b Raw
56 lines · c
1// RUN: %clang_builtins %s %librt -o %t && %run %t2// REQUIRES: librt_has_fixtfsi3 4#include <stdio.h>5 6#if __LDBL_MANT_DIG__ == 1137 8#include "fp_test.h"9 10int __fixtfsi(long double a);11 12int test__fixtfsi(long double a, int expected)13{14    int x = __fixtfsi(a);15    int ret = (x != expected);16 17    if (ret){18        printf("error in test__fixtfsi(%.20Lf) = %d, "19               "expected %d\n", a, x, expected);20    }21    return ret;22}23 24char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};25 26#endif27 28int main()29{30#if __LDBL_MANT_DIG__ == 11331    if (test__fixtfsi(makeInf128(), 0x7fffffff))32        return 1;33    if (test__fixtfsi(0, 0x0))34        return 1;35    if (test__fixtfsi(0x1.23456789abcdefp+5, 0x24))36        return 1;37    if (test__fixtfsi(0x1.23456789abcdefp-3, 0x0))38        return 1;39    if (test__fixtfsi(0x1.23456789abcdefp+20, 0x123456))40        return 1;41    if (test__fixtfsi(0x1.23456789abcdefp+40, 0x7fffffff))42        return 1;43    if (test__fixtfsi(0x1.23456789abcdefp+256, 0x7fffffff))44        return 1;45    if (test__fixtfsi(-0x1.23456789abcdefp+20, 0xffedcbaa))46        return 1;47    if (test__fixtfsi(-0x1.23456789abcdefp+40, 0x80000000))48        return 1;49 50#else51    printf("skipped\n");52 53#endif54    return 0;55}56