1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
2 // RUN: %clang_cc1 -triple riscv32 -emit-llvm %s -o - \
3 // RUN: | FileCheck -check-prefix=NOHALF %s
4 // RUN: %clang_cc1 -triple riscv64 -emit-llvm %s -o - \
5 // RUN: | FileCheck -check-prefix=NOHALF %s
6 // RUN: %clang_cc1 -triple riscv32 -target-feature +zfh -emit-llvm %s -o - \
7 // RUN: | FileCheck -check-prefix=ZFH %s
8 // RUN: %clang_cc1 -triple riscv64 -target-feature +zfh -emit-llvm %s -o - \
9 // RUN: | FileCheck -check-prefix=ZFH %s
10 // RUN: %clang_cc1 -triple riscv32 -target-feature +zhinx -emit-llvm %s -o - \
11 // RUN: | FileCheck -check-prefix=ZHINX %s
12 // RUN: %clang_cc1 -triple riscv64 -target-feature +zhinx -emit-llvm %s -o - \
13 // RUN: | FileCheck -check-prefix=ZHINX %s
17 // With no native half type support (no zfh), f16 will be promoted to f32.
18 // With zfh, it shouldn't be.
20 // NOHALF-LABEL: define dso_local void @f16_add
21 // NOHALF-SAME: () #[[ATTR0:[0-9]+]] {
22 // NOHALF-NEXT: entry:
23 // NOHALF-NEXT: [[TMP0:%.*]] = load half, ptr @y, align 2
24 // NOHALF-NEXT: [[EXT:%.*]] = fpext half [[TMP0]] to float
25 // NOHALF-NEXT: [[TMP1:%.*]] = load half, ptr @z, align 2
26 // NOHALF-NEXT: [[EXT1:%.*]] = fpext half [[TMP1]] to float
27 // NOHALF-NEXT: [[ADD:%.*]] = fadd float [[EXT]], [[EXT1]]
28 // NOHALF-NEXT: [[UNPROMOTION:%.*]] = fptrunc float [[ADD]] to half
29 // NOHALF-NEXT: store half [[UNPROMOTION]], ptr @x, align 2
30 // NOHALF-NEXT: ret void
32 // ZFH-LABEL: define dso_local void @f16_add
33 // ZFH-SAME: () #[[ATTR0:[0-9]+]] {
35 // ZFH-NEXT: [[TMP0:%.*]] = load half, ptr @y, align 2
36 // ZFH-NEXT: [[TMP1:%.*]] = load half, ptr @z, align 2
37 // ZFH-NEXT: [[ADD:%.*]] = fadd half [[TMP0]], [[TMP1]]
38 // ZFH-NEXT: store half [[ADD]], ptr @x, align 2
41 // ZHINX-LABEL: define dso_local void @f16_add
42 // ZHINX-SAME: () #[[ATTR0:[0-9]+]] {
44 // ZHINX-NEXT: [[TMP0:%.*]] = load half, ptr @y, align 2
45 // ZHINX-NEXT: [[TMP1:%.*]] = load half, ptr @z, align 2
46 // ZHINX-NEXT: [[ADD:%.*]] = fadd half [[TMP0]], [[TMP1]]
47 // ZHINX-NEXT: store half [[ADD]], ptr @x, align 2
48 // ZHINX-NEXT: ret void