| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux -DSANITIZER_ENABLED -fsanitize=address -fsanitize-address-field-padding=1 %s | ||
| // RUN: %clang_cc1 -triple x86_64-unknown-linux %s | ||
|
|
||
| struct S { | ||
| ~S() {} | ||
| virtual void foo() {} | ||
|
|
||
| int buffer[1]; | ||
| int other_field = 0; | ||
| }; | ||
|
|
||
| union U { | ||
| S s; | ||
| }; | ||
|
|
||
| struct Derived : S {}; | ||
|
|
||
| static_assert(!__is_trivially_copyable(S)); | ||
| #ifdef SANITIZER_ENABLED | ||
| // Don't allow memcpy when the struct has poisoned padding bits. | ||
| // The sanitizer adds posion padding bits to struct S. | ||
| static_assert(sizeof(S) > 16); | ||
| static_assert(!__is_bitwise_cloneable(S)); | ||
| static_assert(sizeof(U) == sizeof(S)); // no padding bit for U. | ||
| static_assert(!__is_bitwise_cloneable(U)); | ||
| static_assert(!__is_bitwise_cloneable(S[2])); | ||
| static_assert(!__is_bitwise_cloneable(Derived)); | ||
| #else | ||
| static_assert(sizeof(S) == 16); | ||
| static_assert(__is_bitwise_cloneable(S)); | ||
| static_assert(__is_bitwise_cloneable(U)); | ||
| static_assert(__is_bitwise_cloneable(S[2])); | ||
| static_assert(__is_bitwise_cloneable(Derived)); | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // RUN: %clang_cc1 -fsyntax-only -verify %s | ||
| // | ||
| struct DynamicClass { virtual int Foo(); }; | ||
| static_assert(!__is_trivially_copyable(DynamicClass)); | ||
| static_assert(__is_bitwise_cloneable(DynamicClass)); | ||
|
|
||
| struct InComplete; // expected-note{{forward declaration}} | ||
| static_assert(!__is_bitwise_cloneable(InComplete)); // expected-error{{incomplete type 'InComplete' used in type trait expression}} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // RUN: %clang_dfsan %s -o %t && %run %t | ||
| // XFAIL: * | ||
|
|
||
| #include <assert.h> | ||
| #include <stdio.h> | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| char buf[256] = "10000000000-100000000000 rw-p 00000000 00:00 0"; | ||
| long rss = 0; | ||
| // This test exposes a bug in DFSan's sscanf, that leads to flakiness | ||
| // in release_shadow_space.c (see | ||
| // https://github.com/llvm/llvm-project/issues/91287) | ||
| if (sscanf(buf, "Garbage text before, %ld, Garbage text after", &rss) == 1) { | ||
| printf("Error: matched %ld\n", rss); | ||
| return 1; | ||
| } | ||
|
|
||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Test the reduction semantics of fir.do_loop | ||
| // RUN: fir-opt %s | FileCheck %s | ||
|
|
||
| func.func @reduction() { | ||
| %bound = arith.constant 10 : index | ||
| %step = arith.constant 1 : index | ||
| %sum = fir.alloca i32 | ||
| // CHECK: %[[VAL_0:.*]] = fir.alloca i32 | ||
| // CHECK: fir.do_loop %[[VAL_1:.*]] = %[[VAL_2:.*]] to %[[VAL_3:.*]] step %[[VAL_4:.*]] unordered reduce(#fir.reduce_attr<add> -> %[[VAL_0]] : !fir.ref<i32>) { | ||
| fir.do_loop %iv = %step to %bound step %step unordered reduce(#fir.reduce_attr<add> -> %sum : !fir.ref<i32>) { | ||
| %index = fir.convert %iv : (index) -> i32 | ||
| %1 = fir.load %sum : !fir.ref<i32> | ||
| %2 = arith.addi %index, %1 : i32 | ||
| fir.store %2 to %sum : !fir.ref<i32> | ||
| } | ||
| return | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ! Test GETCWD with dynamically optional arguments. | ||
| ! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
|
|
||
| ! CHECK-LABEL: func.func @_QPtest( | ||
| ! CHECK-SAME: %[[cwdArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "cwd"}) -> i32 { | ||
| integer function test(cwd) | ||
| CHARACTER(len=255) :: cwd | ||
| test = getcwd(cwd) | ||
| ! CHECK-NEXT: %[[c8:.*]] = arith.constant 8 : i32 | ||
| ! CHECK-NEXT: %[[c255:.*]] = arith.constant 255 : index | ||
| ! CHECK-NEXT: %[[DSCOPE:.*]] = fir.dummy_scope : !fir.dscope | ||
| ! CHECK-NEXT: %[[cwdUnbox:.*]]:2 = fir.unboxchar %[[cwdArg]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index) | ||
| ! CHECK-NEXT: %[[cwdCast:.*]] = fir.convert %[[cwdUnbox]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[cwdDeclare:.*]] = fir.declare %[[cwdCast]] typeparams %[[c255]] dummy_scope %[[DSCOPE]] {uniq_name = "_QFtestEcwd"} : (!fir.ref<!fir.char<1,255>>, index, !fir.dscope) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[test:.*]] = fir.alloca i32 {bindc_name = "test", uniq_name = "_QFtestEtest"} | ||
| ! CHECK-NEXT: %[[testAddr:.*]] = fir.declare %[[test]] {uniq_name = "_QFtestEtest"} : (!fir.ref<i32>) -> !fir.ref<i32> | ||
| ! CHECK-NEXT: %[[cwdBox:.*]] = fir.embox %[[cwdDeclare]] : (!fir.ref<!fir.char<1,255>>) -> !fir.box<!fir.char<1,255>> | ||
| ! CHECK: %[[cwd:.*]] = fir.convert %[[cwdBox]] : (!fir.box<!fir.char<1,255>>) -> !fir.box<none> | ||
| ! CHECK: %[[statusValue:.*]] = fir.call @_FortranAGetCwd(%[[cwd]], %[[VAL_9:.*]], %[[c8]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> i32 | ||
| ! CHECK-NEXT: fir.store %[[statusValue]] to %[[testAddr]] : !fir.ref<i32> | ||
| ! CHECK-NEXT: %[[returnValue:.*]] = fir.load %[[testAddr]] : !fir.ref<i32> | ||
| ! CHECK-NEXT: return %[[returnValue]] : i32 | ||
| end function |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| ! Test GETCWD with dynamically optional arguments. | ||
| ! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
|
|
||
|
|
||
| ! CHECK-LABEL: func.func @_QPtest( | ||
| ! CHECK-SAME: %[[cwdArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "cwd"}, | ||
| ! CHECK-SAME: %[[statusArg:.*]]: !fir.ref<i32> {fir.bindc_name = "status", fir.optional}) { | ||
| subroutine test(cwd, status) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER, OPTIONAL :: status | ||
| call getcwd(cwd, status) | ||
| ! CHECK-NEXT: %[[c0:.*]] = arith.constant 0 : i64 | ||
| ! CHECK-NEXT: %[[c11:.*]] = arith.constant 11 : i32 | ||
| ! CHECK-NEXT: %[[c255:.*]] = arith.constant 255 : index | ||
| ! CHECK-NEXT: %[[DSCOPE:.*]] = fir.dummy_scope : !fir.dscope | ||
| ! CHECK-NEXT: %[[cwdUnbox:.*]]:2 = fir.unboxchar %[[cwdArg]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index) | ||
| ! CHECK-NEXT: %[[cwdCast:.*]] = fir.convert %[[cwdUnbox]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[cwdDeclare:.*]] = fir.declare %[[cwdCast]] typeparams %[[c255]] dummy_scope %[[DSCOPE]] {uniq_name = "_QFtestEcwd"} : (!fir.ref<!fir.char<1,255>>, index, !fir.dscope) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[statusAddr:.*]] = fir.declare %[[statusArg]] dummy_scope %[[DSCOPE]] {fortran_attrs = #fir.var_attrs<optional>, uniq_name = "_QFtestEstatus"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> | ||
| ! CHECK-NEXT: %[[cwdBox:.*]] = fir.embox %[[cwdDeclare]] : (!fir.ref<!fir.char<1,255>>) -> !fir.box<!fir.char<1,255>> | ||
| ! CHECK: %[[cwd:.*]] = fir.convert %[[cwdBox]] : (!fir.box<!fir.char<1,255>>) -> !fir.box<none> | ||
| ! CHECK: %[[statusValue:.*]] = fir.call @_FortranAGetCwd(%[[cwd]], %[[VAL_8:.*]], %[[c11]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> i32 | ||
| ! CHECK-NEXT: %[[statusCast:.*]] = fir.convert %[[statusAddr]] : (!fir.ref<i32>) -> i64 | ||
| ! CHECK-NEXT: %[[isPresent:.*]] = arith.cmpi ne, %[[statusCast]], %[[c0]] : i64 | ||
| ! CHECK-NEXT: fir.if %[[isPresent]] { | ||
| ! CHECK-NEXT: fir.store %[[statusValue]] to %[[statusAddr]] : !fir.ref<i32> | ||
| ! CHECK-NEXT: } | ||
| ! CHECK-NEXT: return | ||
| end subroutine |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ! RUN: bbc -emit-fir %s -o - | FileCheck %s | ||
|
|
||
| ! CHECK-LABEL: func.func @_QPcwd_only( | ||
| ! CHECK-SAME: %[[cwdArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "cwd"}) { | ||
| subroutine cwd_only(cwd) | ||
| CHARACTER(len=255) :: cwd | ||
| call getcwd(cwd) | ||
| ! CHECK-NEXT: %[[c7:.*]] = arith.constant 7 : i32 | ||
| ! CHECK-NEXT: %[[c255:.*]] = arith.constant 255 : index | ||
| ! CHECK-NEXT: %[[DSCOPE:.*]] = fir.dummy_scope : !fir.dscope | ||
| ! CHECK-NEXT: %[[cwdUnbox:.*]]:2 = fir.unboxchar %[[cwdArg]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index) | ||
| ! CHECK-NEXT: %[[cwdCast:.*]] = fir.convert %[[cwdUnbox]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[cwdDeclare:.*]] = fir.declare %[[cwdCast]] typeparams %[[c255]] dummy_scope %[[DSCOPE]] {uniq_name = "_QFcwd_onlyEcwd"} : (!fir.ref<!fir.char<1,255>>, index, !fir.dscope) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[cwdBox:.*]] = fir.embox %[[cwdDeclare]] : (!fir.ref<!fir.char<1,255>>) -> !fir.box<!fir.char<1,255>> | ||
| ! CHECK: %[[cwd:.*]] = fir.convert %[[cwdBox]] : (!fir.box<!fir.char<1,255>>) -> !fir.box<none> | ||
| ! CHECK: %[[statusValue:.*]] = fir.call @_FortranAGetCwd(%[[cwd]], %[[VAL_7:.*]], %[[c7]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> i32 | ||
| ! CHECK-NEXT: return | ||
| end subroutine cwd_only | ||
|
|
||
| ! CHECK-LABEL: func.func @_QPall_arguments( | ||
| ! CHECK-SAME: %[[cwdArg:.*]]: !fir.boxchar<1> {fir.bindc_name = "cwd"}, | ||
| ! CHECK-SAME: %[[statusArg:.*]]: !fir.ref<i32> {fir.bindc_name = "status"}) { | ||
| subroutine all_arguments(cwd, status) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER :: status | ||
| call getcwd(cwd, status) | ||
| ! CHECK-NEXT: %[[c0:.*]] = arith.constant 0 : i64 | ||
| ! CHECK-NEXT: %[[c26:.*]] = arith.constant 26 : i32 | ||
| ! CHECK-NEXT: %[[c255:.*]] = arith.constant 255 : index | ||
| ! CHECK-NEXT: %[[DSCOPE:.*]] = fir.dummy_scope : !fir.dscope | ||
| ! CHECK-NEXT: %[[cwdUnbox:.*]]:2 = fir.unboxchar %[[cwdArg]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index) | ||
| ! CHECK-NEXT: %[[cwdCast:.*]] = fir.convert %[[cwdUnbox]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[cwdDeclare:.*]] = fir.declare %[[cwdCast]] typeparams %[[c255]] dummy_scope %[[DSCOPE]] {uniq_name = "_QFall_argumentsEcwd"} : (!fir.ref<!fir.char<1,255>>, index, !fir.dscope) -> !fir.ref<!fir.char<1,255>> | ||
| ! CHECK-NEXT: %[[statusAddr:.*]] = fir.declare %[[statusArg]] dummy_scope %0 {uniq_name = "_QFall_argumentsEstatus"} : (!fir.ref<i32>, !fir.dscope) -> !fir.ref<i32> | ||
| ! CHECK-NEXT: %[[cwdBox:.*]] = fir.embox %[[cwdDeclare]] : (!fir.ref<!fir.char<1,255>>) -> !fir.box<!fir.char<1,255>> | ||
| ! CHECK: %[[cwd:.*]] = fir.convert %[[cwdBox]] : (!fir.box<!fir.char<1,255>>) -> !fir.box<none> | ||
| ! CHECK: %[[statusValue:.*]] = fir.call @_FortranAGetCwd(%[[cwd]], %[[VAL_8:.*]], %[[c26]]) fastmath<contract> : (!fir.box<none>, !fir.ref<i8>, i32) -> i32 | ||
| ! CHECK-NEXT: %[[statusCast:.*]] = fir.convert %[[statusAddr]] : (!fir.ref<i32>) -> i64 | ||
| ! CHECK-NEXT: %[[isPresent:.*]] = arith.cmpi ne, %[[statusCast]], %[[c0]] : i64 | ||
| ! CHECK-NEXT: fir.if %[[isPresent]] { | ||
| ! CHECK-NEXT: fir.store %[[statusValue]] to %[[statusAddr]] : !fir.ref<i32> | ||
| ! CHECK-NEXT: } | ||
| ! CHECK-NEXT: return | ||
| end subroutine all_arguments |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| ! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic | ||
| ! Tests for the GETCWD intrinsics | ||
|
|
||
| subroutine bad_kind_error(cwd, status) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER(2) :: status | ||
| !ERROR: Actual argument for 'status=' has bad type or kind 'INTEGER(2)' | ||
| call getcwd(cwd, status) | ||
| end subroutine bad_kind_error | ||
|
|
||
| subroutine bad_args_error() | ||
| !ERROR: missing mandatory 'c=' argument | ||
| call getcwd() | ||
| end subroutine bad_args_error | ||
|
|
||
| subroutine bad_apply_form(cwd) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER :: status | ||
| !Declaration of 'getcwd' | ||
| call getcwd(cwd, status) | ||
| !ERROR: Cannot call subroutine 'getcwd' like a function | ||
| status = getcwd(cwd) | ||
| end subroutine bad_apply_form | ||
|
|
||
| subroutine good_subroutine(cwd, status) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER :: status | ||
| call getcwd(cwd, status) | ||
| end subroutine good_subroutine | ||
|
|
||
| subroutine good_function(cwd, status) | ||
| CHARACTER(len=255) :: cwd | ||
| INTEGER :: status | ||
| status = getcwd(cwd) | ||
| end subroutine good_function |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| //===-- Definition of macros from atexithandler_t.h -----------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_HDR_ATEXITHANDLER_T_H | ||
| #define LLVM_LIBC_HDR_ATEXITHANDLER_T_H | ||
|
|
||
| #ifdef LIBC_FULL_BUILD | ||
|
|
||
| #include "include/llvm-libc-types/__atexithandler_t.h" | ||
|
|
||
| #else // overlay mode | ||
|
|
||
| #error // type not available in overlay mode | ||
|
|
||
| #endif // LLVM_LIBC_FULL_BUILD | ||
|
|
||
| #endif // LLVM_LIBC_HDR_ATEXITHANDLER_T_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fmaximum_mag_numf16 -----------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fmaximum_mag_numf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAG_NUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fmaximum_magf16 ---------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fmaximum_magf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_MAGF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fmaximum_numf16 ---------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fmaximum_numf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMAXIMUM_NUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fmaximumf16 -------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMAXIMUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMAXIMUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fmaximumf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMAXIMUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fminimum_mag_numf16 -----------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fminimum_mag_numf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAG_NUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fminimum_magf16 ---------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fminimum_magf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMINIMUM_MAGF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fminimum_numf16 ---------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fminimum_numf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMINIMUM_NUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for fminimumf16 -------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_FMINIMUMF16_H | ||
| #define LLVM_LIBC_SRC_MATH_FMINIMUMF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 fminimumf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_FMINIMUMF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fmaximum_mag_numf16 function --------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fmaximum_mag_numf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fmaximum_mag_numf16, (float16 x, float16 y)) { | ||
| return fputil::fmaximum_mag_num(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fmaximum_magf16 function ------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fmaximum_magf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fmaximum_magf16, (float16 x, float16 y)) { | ||
| return fputil::fmaximum_mag(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fmaximum_numf16 function ------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fmaximum_numf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fmaximum_numf16, (float16 x, float16 y)) { | ||
| return fputil::fmaximum_num(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fmaximumf16 function ----------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fmaximumf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fmaximumf16, (float16 x, float16 y)) { | ||
| return fputil::fmaximum(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fminimum_mag_numf16 function --------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fminimum_mag_numf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fminimum_mag_numf16, (float16 x, float16 y)) { | ||
| return fputil::fminimum_mag_num(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fminimum_magf16 function ------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fminimum_magf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fminimum_magf16, (float16 x, float16 y)) { | ||
| return fputil::fminimum_mag(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fminimum_numf16 function ------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fminimum_numf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fminimum_numf16, (float16 x, float16 y)) { | ||
| return fputil::fminimum_num(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of fminimumf16 function ----------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/fminimumf16.h" | ||
| #include "src/__support/FPUtil/BasicOperations.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, fminimumf16, (float16 x, float16 y)) { | ||
| return fputil::fminimum(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of nextafterf16 function ---------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/nextafterf16.h" | ||
| #include "src/__support/FPUtil/ManipulationFunctions.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, nextafterf16, (float16 x, float16 y)) { | ||
| return fputil::nextafter(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of nextdownf16 function ----------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/nextdownf16.h" | ||
| #include "src/__support/FPUtil/ManipulationFunctions.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, nextdownf16, (float16 x)) { | ||
| return fputil::nextupdown</*IsDown=*/true>(x); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //===-- Implementation of nexttowardf16 function --------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/nexttowardf16.h" | ||
| #include "src/__support/FPUtil/ManipulationFunctions.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, nexttowardf16, (float16 x, long double y)) { | ||
| // We can reuse the nextafter implementation because the internal nextafter is | ||
| // templated on the types of the arguments. | ||
| return fputil::nextafter(x, y); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| //===-- Implementation of nextupf16 function ------------------------------===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "src/math/nextupf16.h" | ||
| #include "src/__support/FPUtil/ManipulationFunctions.h" | ||
| #include "src/__support/common.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| LLVM_LIBC_FUNCTION(float16, nextupf16, (float16 x)) { | ||
| return fputil::nextupdown</*IsDown=*/false>(x); | ||
| } | ||
|
|
||
| } // namespace LIBC_NAMESPACE |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for nextafterf16 ------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_NEXTAFTERF16_H | ||
| #define LLVM_LIBC_SRC_MATH_NEXTAFTERF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 nextafterf16(float16 x, float16 y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_NEXTAFTERF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for nextdownf16 -------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_NEXTDOWNF16_H | ||
| #define LLVM_LIBC_SRC_MATH_NEXTDOWNF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 nextdownf16(float16 x); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_NEXTDOWNF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for nexttowardf16 -----------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_NEXTTOWARDF16_H | ||
| #define LLVM_LIBC_SRC_MATH_NEXTTOWARDF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 nexttowardf16(float16 x, long double y); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_NEXTTOWARDF16_H |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //===-- Implementation header for nextupf16 ---------------------*- C++ -*-===// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #ifndef LLVM_LIBC_SRC_MATH_NEXTUPF16_H | ||
| #define LLVM_LIBC_SRC_MATH_NEXTUPF16_H | ||
|
|
||
| #include "src/__support/macros/properties/types.h" | ||
|
|
||
| namespace LIBC_NAMESPACE { | ||
|
|
||
| float16 nextupf16(float16 x); | ||
|
|
||
| } // namespace LIBC_NAMESPACE | ||
|
|
||
| #endif // LLVM_LIBC_SRC_MATH_NEXTUPF16_H |