172 lines · c
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 62// RUN: %clang_cc1 -triple riscv64-none-linux-gnu -target-feature +f -target-feature +d -target-feature +zve64d -mvscale-min=4 -mvscale-max=4 -O1 -emit-llvm -o - %s | FileCheck %s3 4// REQUIRES: riscv-registered-target5 6#include <stdint.h>7 8typedef __rvv_int8m1_t vint8m1_t;9typedef __rvv_uint8m1_t vuint8m1_t;10typedef __rvv_int16m1_t vint16m1_t;11typedef __rvv_uint16m1_t vuint16m1_t;12typedef __rvv_int32m1_t vint32m1_t;13typedef __rvv_uint32m1_t vuint32m1_t;14typedef __rvv_int64m1_t vint64m1_t;15typedef __rvv_uint64m1_t vuint64m1_t;16typedef __rvv_float32m1_t vfloat32m1_t;17typedef __rvv_float64m1_t vfloat64m1_t;18 19typedef __rvv_bool1_t vbool1_t;20typedef __rvv_bool4_t vbool4_t;21typedef __rvv_bool32_t vbool32_t;22 23typedef vint64m1_t fixed_int64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));24typedef vfloat64m1_t fixed_float64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));25 26typedef vint32m1_t fixed_int32m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));27typedef vfloat64m1_t fixed_float64m1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));28typedef int32_t gnu_int32m1_t __attribute__((vector_size(__riscv_v_fixed_vlen / 8)));29 30typedef vbool1_t fixed_bool1_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen)));31typedef vbool4_t fixed_bool4_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/4)));32typedef vbool32_t fixed_bool32_t __attribute__((riscv_rvv_vector_bits(__riscv_v_fixed_vlen/32)));33 34// CHECK-LABEL: define dso_local noundef <vscale x 2 x i32> @to_vint32m1_t(35// CHECK-SAME: <vscale x 2 x i32> noundef returned [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {36// CHECK-NEXT: [[ENTRY:.*:]]37// CHECK-NEXT: ret <vscale x 2 x i32> [[TYPE_COERCE]]38//39vint32m1_t to_vint32m1_t(fixed_int32m1_t type) {40 return type;41}42 43// CHECK-LABEL: define dso_local <vscale x 2 x i32> @from_vint32m1_t(44// CHECK-SAME: <vscale x 2 x i32> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {45// CHECK-NEXT: [[ENTRY:.*:]]46// CHECK-NEXT: ret <vscale x 2 x i32> [[TYPE]]47//48fixed_int32m1_t from_vint32m1_t(vint32m1_t type) {49 return type;50}51 52// CHECK-LABEL: define dso_local noundef <vscale x 1 x double> @to_vfloat64m1_t(53// CHECK-SAME: <vscale x 1 x double> noundef returned [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR0]] {54// CHECK-NEXT: [[ENTRY:.*:]]55// CHECK-NEXT: ret <vscale x 1 x double> [[TYPE_COERCE]]56//57vfloat64m1_t to_vfloat64m1_t(fixed_float64m1_t type) {58 return type;59}60 61// CHECK-LABEL: define dso_local <vscale x 1 x double> @from_vfloat64m1_t(62// CHECK-SAME: <vscale x 1 x double> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {63// CHECK-NEXT: [[ENTRY:.*:]]64// CHECK-NEXT: ret <vscale x 1 x double> [[TYPE]]65//66fixed_float64m1_t from_vfloat64m1_t(vfloat64m1_t type) {67 return type;68}69 70// CHECK-LABEL: define dso_local <vscale x 64 x i1> @from_vbool1_t(71// CHECK-SAME: <vscale x 64 x i1> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {72// CHECK-NEXT: [[ENTRY:.*:]]73// CHECK-NEXT: ret <vscale x 64 x i1> [[TYPE]]74//75fixed_bool1_t from_vbool1_t(vbool1_t type) {76 return type;77}78 79// CHECK-LABEL: define dso_local noundef <vscale x 64 x i1> @to_vbool1_t(80// CHECK-SAME: <vscale x 64 x i1> noundef returned [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {81// CHECK-NEXT: [[ENTRY:.*:]]82// CHECK-NEXT: ret <vscale x 64 x i1> [[TMP0]]83//84vbool1_t to_vbool1_t(fixed_bool1_t type) {85 return type;86}87 88// CHECK-LABEL: define dso_local <vscale x 16 x i1> @from_vbool4_t(89// CHECK-SAME: <vscale x 16 x i1> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {90// CHECK-NEXT: [[ENTRY:.*:]]91// CHECK-NEXT: ret <vscale x 16 x i1> [[TYPE]]92//93fixed_bool4_t from_vbool4_t(vbool4_t type) {94 return type;95}96 97// CHECK-LABEL: define dso_local noundef <vscale x 16 x i1> @to_vbool4_t(98// CHECK-SAME: <vscale x 16 x i1> noundef returned [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {99// CHECK-NEXT: [[ENTRY:.*:]]100// CHECK-NEXT: ret <vscale x 16 x i1> [[TMP0]]101//102vbool4_t to_vbool4_t(fixed_bool4_t type) {103 return type;104}105 106// CHECK-LABEL: define dso_local <vscale x 2 x i1> @from_vbool32_t(107// CHECK-SAME: <vscale x 2 x i1> returned [[TYPE:%.*]]) local_unnamed_addr #[[ATTR0]] {108// CHECK-NEXT: [[ENTRY:.*:]]109// CHECK-NEXT: ret <vscale x 2 x i1> [[TYPE]]110//111fixed_bool32_t from_vbool32_t(vbool32_t type) {112 return type;113}114 115// CHECK-LABEL: define dso_local noundef <vscale x 2 x i1> @to_vbool32_t(116// CHECK-SAME: <vscale x 2 x i1> noundef returned [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0]] {117// CHECK-NEXT: [[ENTRY:.*:]]118// CHECK-NEXT: ret <vscale x 2 x i1> [[TMP0]]119//120vbool32_t to_vbool32_t(fixed_bool32_t type) {121 return type;122}123 124// CHECK-LABEL: define dso_local <vscale x 2 x i32> @to_vint32m1_t__from_gnu_int32m1_t(125// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2:[0-9]+]] {126// CHECK-NEXT: [[ENTRY:.*:]]127// CHECK-NEXT: [[TYPE:%.*]] = load <8 x i32>, ptr [[TMP0]], align 32, !tbaa [[CHAR_TBAA10:![0-9]+]]128// CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 2 x i32> @llvm.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32> poison, <8 x i32> [[TYPE]], i64 0)129// CHECK-NEXT: ret <vscale x 2 x i32> [[CAST_SCALABLE]]130//131vint32m1_t to_vint32m1_t__from_gnu_int32m1_t(gnu_int32m1_t type) {132 return type;133}134 135// CHECK-LABEL: define dso_local void @from_vint32m1_t__to_gnu_int32m1_t(136// CHECK-SAME: ptr dead_on_unwind noalias writable writeonly sret(<8 x i32>) align 32 captures(none) initializes((0, 32)) [[AGG_RESULT:%.*]], <vscale x 2 x i32> [[TYPE:%.*]]) local_unnamed_addr #[[ATTR3:[0-9]+]] {137// CHECK-NEXT: [[ENTRY:.*:]]138// CHECK-NEXT: [[CAST_FIXED:%.*]] = tail call <8 x i32> @llvm.vector.extract.v8i32.nxv2i32(<vscale x 2 x i32> [[TYPE]], i64 0)139// CHECK-NEXT: store <8 x i32> [[CAST_FIXED]], ptr [[AGG_RESULT]], align 32, !tbaa [[CHAR_TBAA10]]140// CHECK-NEXT: ret void141//142gnu_int32m1_t from_vint32m1_t__to_gnu_int32m1_t(vint32m1_t type) {143 return type;144}145 146// CHECK-LABEL: define dso_local <vscale x 2 x i32> @to_fixed_int32m1_t__from_gnu_int32m1_t(147// CHECK-SAME: ptr dead_on_return noundef readonly captures(none) [[TMP0:%.*]]) local_unnamed_addr #[[ATTR2]] {148// CHECK-NEXT: [[ENTRY:.*:]]149// CHECK-NEXT: [[TYPE:%.*]] = load <8 x i32>, ptr [[TMP0]], align 32, !tbaa [[CHAR_TBAA10]]150// CHECK-NEXT: [[CAST_SCALABLE:%.*]] = tail call <vscale x 2 x i32> @llvm.vector.insert.nxv2i32.v8i32(<vscale x 2 x i32> poison, <8 x i32> [[TYPE]], i64 0)151// CHECK-NEXT: ret <vscale x 2 x i32> [[CAST_SCALABLE]]152//153fixed_int32m1_t to_fixed_int32m1_t__from_gnu_int32m1_t(gnu_int32m1_t type) {154 return type;155}156 157// CHECK-LABEL: define dso_local void @from_fixed_int32m1_t__to_gnu_int32m1_t(158// CHECK-SAME: ptr dead_on_unwind noalias writable writeonly sret(<8 x i32>) align 32 captures(none) initializes((0, 32)) [[AGG_RESULT:%.*]], <vscale x 2 x i32> noundef [[TYPE_COERCE:%.*]]) local_unnamed_addr #[[ATTR3]] {159// CHECK-NEXT: [[ENTRY:.*:]]160// CHECK-NEXT: [[TYPE:%.*]] = tail call <8 x i32> @llvm.vector.extract.v8i32.nxv2i32(<vscale x 2 x i32> [[TYPE_COERCE]], i64 0)161// CHECK-NEXT: store <8 x i32> [[TYPE]], ptr [[AGG_RESULT]], align 32, !tbaa [[CHAR_TBAA10]]162// CHECK-NEXT: ret void163//164gnu_int32m1_t from_fixed_int32m1_t__to_gnu_int32m1_t(fixed_int32m1_t type) {165 return type;166}167//.168// CHECK: [[META8:![0-9]+]] = !{!"omnipotent char", [[META9:![0-9]+]], i64 0}169// CHECK: [[META9]] = !{!"Simple C/C++ TBAA"}170// CHECK: [[CHAR_TBAA10]] = !{[[META8]], [[META8]], i64 0}171//.172