brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.8 KiB · 023b012 Raw
416 lines · plain
1; RUN: mlir-translate -import-llvm -split-input-file %s --verify-diagnostics | FileCheck %s2 3; CHECK: llvm.func internal @func_internal4define internal void @func_internal() {5  ret void6}7 8; CHECK: llvm.func internal spir_funccc @spir_func_internal()9define internal spir_func void @spir_func_internal() {10  ret void11}12 13; // -----14 15; Ensure that we have dso_local.16; CHECK: llvm.func @dsolocal_func()17; CHECK-SAME: attributes {dso_local}18define dso_local void @dsolocal_func() {19  ret void20}21 22; // -----23 24; CHECK-LABEL: @func_readnone25; CHECK-SAME:  attributes {memory_effects = #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none, errnoMem = none, targetMem0 = none, targetMem1 = none>}26; CHECK:   llvm.return27define void @func_readnone() readnone {28  ret void29}30 31; CHECK-LABEL: @func_readnone_indirect32; CHECK-SAME:  attributes {memory_effects = #llvm.memory_effects<other = none, argMem = none, inaccessibleMem = none, errnoMem = none, targetMem0 = none, targetMem1 = none>}33declare void @func_readnone_indirect() #034attributes #0 = { readnone }35 36; // -----37 38; CHECK-LABEL: @func_arg_attrs39; CHECK-SAME:  !llvm.ptr {llvm.byval = i64}40; CHECK-SAME:  !llvm.ptr {llvm.byref = i64}41; CHECK-SAME:  !llvm.ptr {llvm.noalias}42; CHECK-SAME:  !llvm.ptr {llvm.readonly}43; CHECK-SAME:  !llvm.ptr {llvm.nest}44; CHECK-SAME:  i32 {llvm.signext}45; CHECK-SAME:  i64 {llvm.zeroext}46; CHECK-SAME:  !llvm.ptr {llvm.align = 64 : i64, llvm.noundef}47; CHECK-SAME:  !llvm.ptr {llvm.dereferenceable = 12 : i64}48; CHECK-SAME:  !llvm.ptr {llvm.dereferenceable_or_null = 42 : i64}49; CHECK-SAME:  f64 {llvm.inreg}50; CHECK-SAME:  !llvm.ptr {llvm.nocapture}51; CHECK-SAME:  !llvm.ptr {llvm.nofree}52; CHECK-SAME:  !llvm.ptr {llvm.nonnull}53; CHECK-SAME:  !llvm.ptr {llvm.preallocated = f64}54; CHECK-SAME:  !llvm.ptr {llvm.returned}55; CHECK-SAME:  !llvm.ptr {llvm.alignstack = 32 : i64}56; CHECK-SAME:  !llvm.ptr {llvm.writeonly}57; CHECK-SAME:  i64 {llvm.range = #llvm.constant_range<i64, 0, 4097>}58define ptr @func_arg_attrs(59    ptr byval(i64) %arg0,60    ptr byref(i64) %arg1,61    ptr noalias %arg4,62    ptr readonly %arg5,63    ptr nest %arg6,64    i32 signext %arg7,65    i64 zeroext %arg8,66    ptr align(64) noundef %arg9,67    ptr dereferenceable(12) %arg10,68    ptr dereferenceable_or_null(42) %arg11,69    double inreg %arg12,70    ptr captures(none) %arg13,71    ptr nofree %arg14,72    ptr nonnull %arg15,73    ptr preallocated(double) %arg16,74    ptr returned %arg17,75    ptr alignstack(32) %arg18,76    ptr writeonly %arg19,77    i64 range(i64 0, 4097) %arg20) {78  ret ptr %arg1779}80 81; CHECK-LABEL: @sret82; CHECK-SAME:  !llvm.ptr {llvm.sret = i64}83define void @sret(ptr sret(i64) %arg0) {84  ret void85}86 87; CHECK-LABEL: @inalloca88; CHECK-SAME:  !llvm.ptr {llvm.inalloca = i64}89define void @inalloca(ptr inalloca(i64) %arg0) {90  ret void91}92 93; CHECK-LABEL: @allocator94; CHECK-SAME:  i64 {llvm.allocalign}95; CHECK-SAME:  ptr {llvm.allocptr}96declare ptr @allocator(i64 allocalign, ptr allocptr)97 98; // -----99 100; CHECK-LABEL: @func_res_attr_noalias101; CHECK-SAME:  !llvm.ptr {llvm.noalias}102declare noalias ptr @func_res_attr_noalias()103 104; // -----105 106; CHECK-LABEL: @func_res_attr_nonnull107; CHECK-SAME:  !llvm.ptr {llvm.nonnull}108declare nonnull ptr @func_res_attr_nonnull()109 110; // -----111 112; CHECK-LABEL: @func_res_attr_signext113; CHECK-DAG: llvm.noundef114; CHECK-DAG: llvm.signext115declare noundef signext i32 @func_res_attr_signext()116 117; // -----118 119; CHECK-LABEL: @func_res_attr_zeroext120; CHECK-SAME:  i32 {llvm.zeroext}121declare zeroext i32 @func_res_attr_zeroext()122 123; // -----124 125; CHECK-LABEL: @func_res_attr_align126; CHECK-SAME:  !llvm.ptr {llvm.align = 16 : i64}127declare align(16) ptr @func_res_attr_align()128 129; // -----130 131; CHECK-LABEL: @func_res_attr_noundef132; CHECK-SAME:  !llvm.ptr {llvm.noundef}133declare noundef ptr @func_res_attr_noundef()134 135; // -----136 137; CHECK-LABEL: @func_res_attr_dereferenceable138; CHECK-SAME:  !llvm.ptr {llvm.dereferenceable = 42 : i64}139declare dereferenceable(42) ptr @func_res_attr_dereferenceable()140 141; // -----142 143; CHECK-LABEL: @func_res_attr_dereferenceable_or_null144; CHECK-SAME:  !llvm.ptr {llvm.dereferenceable_or_null = 42 : i64}145declare dereferenceable_or_null(42) ptr @func_res_attr_dereferenceable_or_null()146 147; // -----148 149; CHECK-LABEL: @func_res_attr_inreg150; CHECK-SAME:  !llvm.ptr {llvm.inreg}151declare inreg ptr @func_res_attr_inreg()152 153; // -----154 155; CHECK-LABEL: @func_res_attr_range156; CHECK-SAME:  (i64 {llvm.range = #llvm.constant_range<i64, 0, 4097>})157declare range(i64 0, 4097) i64 @func_res_attr_range()158 159; // -----160 161; CHECK-LABEL: @entry_count162; CHECK-SAME:  attributes {function_entry_count = 4242 : i64}163define void @entry_count() !prof !1 {164  ret void165}166 167!1 = !{!"function_entry_count", i64 4242}168 169; // -----170 171; CHECK-LABEL: @func_memory172; CHECK-SAME:  attributes {memory_effects = #llvm.memory_effects<other = readwrite, argMem = none, inaccessibleMem = readwrite, errnoMem = readwrite, targetMem0 = readwrite, targetMem1 = readwrite>}173; CHECK:   llvm.return174define void @func_memory() memory(readwrite, argmem: none) {175  ret void176}177 178; // -----179 180; CHECK-LABEL: @passthrough_combined181; CHECK-SAME: attributes {passthrough = [182; CHECK-DAG: ["alignstack", "16"]183; CHECK-DAG: "probe-stack"184; CHECK-DAG: ["alloc-family", "malloc"]185; CHECK:   llvm.return186define void @passthrough_combined() alignstack(16) "probe-stack" "alloc-family"="malloc" {187  ret void188}189 190// -----191 192; CHECK-LABEL: @passthrough_string_only193; CHECK-SAME: attributes {passthrough = ["no-enum-attr"]}194; CHECK:   llvm.return195define void @passthrough_string_only() "no-enum-attr" {196  ret void197}198 199// -----200 201; CHECK-LABEL: llvm.func hidden @hidden()202define hidden void @hidden() {203  ret void204}205 206// -----207 208; CHECK-LABEL: llvm.func protected @protected()209define protected void @protected() {210  ret void211}212 213// -----214 215; CHECK-LABEL: @streaming_func216; CHECK-SAME: attributes {arm_streaming}217define void @streaming_func() "aarch64_pstate_sm_enabled" {218  ret void219}220 221// -----222 223; CHECK-LABEL: @locally_streaming_func224; CHECK-SAME: attributes {arm_locally_streaming}225define void @locally_streaming_func() "aarch64_pstate_sm_body" {226  ret void227}228 229// -----230 231; CHECK-LABEL: @streaming_compatible_func232; CHECK-SAME: attributes {arm_streaming_compatible}233define void @streaming_compatible_func() "aarch64_pstate_sm_compatible" {234  ret void235}236 237// -----238 239; CHECK-LABEL: @arm_new_za_func240; CHECK-SAME: attributes {arm_new_za}241define void @arm_new_za_func() "aarch64_new_za" {242  ret void243}244 245 246; CHECK-LABEL: @arm_in_za_func247; CHECK-SAME: attributes {arm_in_za}248define void @arm_in_za_func() "aarch64_in_za" {249  ret void250}251 252; CHECK-LABEL: @arm_out_za_func253; CHECK-SAME: attributes {arm_out_za}254define void @arm_out_za_func() "aarch64_out_za" {255  ret void256}257 258; CHECK-LABEL: @arm_inout_za_func259; CHECK-SAME: attributes {arm_inout_za}260define void @arm_inout_za_func() "aarch64_inout_za" {261  ret void262}263 264; CHECK-LABEL: @arm_preserves_za_func265; CHECK-SAME: attributes {arm_preserves_za}266define void @arm_preserves_za_func() "aarch64_preserves_za" {267  ret void268}269 270// -----271 272; CHECK-LABEL: @section_func273; CHECK-SAME: attributes {section = ".section.name"}274define void @section_func() section ".section.name" {275  ret void276}277 278// -----279 280; CHECK-LABEL: local_unnamed_addr @local_unnamed_addr_func281define void @local_unnamed_addr_func() local_unnamed_addr {282  ret void283}284 285// -----286 287; CHECK-LABEL: unnamed_addr @unnamed_addr_func288declare void @unnamed_addr_func() unnamed_addr289 290// -----291 292; CHECK-LABEL: @align_func293; CHECK-SAME: attributes {alignment = 2 : i64}294define void @align_func() align 2 {295  ret void296}297 298// -----299 300; CHECK-LABEL: @align_decl301; CHECK-SAME: attributes {alignment = 64 : i64}302declare void @align_decl() align 64303 304; // -----305 306; CHECK-LABEL: @func_attr_no_infs_fp_math_true307; CHECK-SAME: attributes {no_infs_fp_math = true}308declare void @func_attr_no_infs_fp_math_true() "no-infs-fp-math"="true"309 310; // -----311 312; CHECK-LABEL: @func_attr_no_infs_fp_math_false313; CHECK-SAME: attributes {no_infs_fp_math = false}314declare void @func_attr_no_infs_fp_math_false() "no-infs-fp-math"="false"315 316; // -----317 318; CHECK-LABEL: @func_attr_no_nans_fp_math_true319; CHECK-SAME: attributes {no_nans_fp_math = true}320declare void @func_attr_no_nans_fp_math_true() "no-nans-fp-math"="true"321 322; // -----323 324; CHECK-LABEL: @func_attr_no_nans_fp_math_false325; CHECK-SAME: attributes {no_nans_fp_math = false}326declare void @func_attr_no_nans_fp_math_false() "no-nans-fp-math"="false"327 328; // -----329 330; CHECK-LABEL: @func_attr_no_signed_zeros_fp_math_true331; CHECK-SAME: attributes {no_signed_zeros_fp_math = true}332declare void @func_attr_no_signed_zeros_fp_math_true() "no-signed-zeros-fp-math"="true"333 334; // -----335 336; CHECK-LABEL: @func_attr_no_signed_zeros_fp_math_false337; CHECK-SAME: attributes {no_signed_zeros_fp_math = false}338declare void @func_attr_no_signed_zeros_fp_math_false() "no-signed-zeros-fp-math"="false"339 340; // -----341 342; CHECK-LABEL: @func_attr_denormal_fp_math_ieee343; CHECK-SAME: attributes {denormal_fp_math = "ieee"}344declare void @func_attr_denormal_fp_math_ieee() "denormal-fp-math"="ieee"345 346; // -----347 348; CHECK-LABEL: @func_attr_denormal_fp_math_f32_preserve_sign349; CHECK-SAME: attributes {denormal_fp_math_f32 = "preserve-sign"}350declare void @func_attr_denormal_fp_math_f32_preserve_sign() "denormal-fp-math-f32"="preserve-sign"351 352; // -----353 354; CHECK-LABEL: @func_attr_fp_contract_fast355; CHECK-SAME: attributes {fp_contract = "fast"}356declare void @func_attr_fp_contract_fast() "fp-contract"="fast"357 358// -----359 360; CHECK-LABEL: @func_attr_instrument_function_entry361; CHECK-SAME: attributes {instrument_function_entry = "__cyg_profile_func_enter"}362declare void @func_attr_instrument_function_entry() "instrument-function-entry"="__cyg_profile_func_enter"363 364// -----365 366; CHECK-LABEL: @func_attr_instrument_function_exit367; CHECK-SAME: attributes {instrument_function_exit = "__cyg_profile_func_exit"}368declare void @func_attr_instrument_function_exit() "instrument-function-exit"="__cyg_profile_func_exit"369 370// -----371 372; CHECK-LABEL: @noinline_attribute373; CHECK-SAME: attributes {no_inline}374declare void @noinline_attribute() noinline375 376// -----377 378; CHECK-LABEL: @alwaysinline_attribute379; CHECK-SAME: attributes {always_inline}380declare void @alwaysinline_attribute() alwaysinline381 382// -----383 384; CHECK-LABEL: @inlinehint_attribute385; CHECK-SAME: attributes {inline_hint}386declare void @inlinehint_attribute() inlinehint387 388// -----389 390; CHECK-LABEL: @optnone_attribute391; CHECK-SAME: attributes {no_inline, optimize_none}392declare void @optnone_attribute() noinline optnone393 394// -----395 396; CHECK-LABEL: @convergent_attribute397; CHECK-SAME: attributes {convergent}398declare void @convergent_attribute() convergent399 400// -----401 402; CHECK-LABEL: @nounwind_attribute403; CHECK-SAME: attributes {no_unwind}404declare void @nounwind_attribute() nounwind405 406// -----407 408; CHECK-LABEL: @willreturn_attribute409; CHECK-SAME: attributes {will_return}410declare void @willreturn_attribute() willreturn411 412// -----413 414; expected-warning @unknown {{'preallocated' attribute is invalid on current operation, skipping it}}415declare void @test() preallocated(i32)416