1 //===- IntrinsicsAMDGPU.td - Defines AMDGPU intrinsics -----*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines all of the R600-specific intrinsics.
12 //===----------------------------------------------------------------------===//
14 let TargetPrefix = "r600" in {
16 class R600ReadPreloadRegisterIntrinsic<string name>
17 : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
20 multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> {
21 def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>;
22 def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>;
23 def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>;
26 defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz <
27 "__builtin_r600_read_global_size">;
28 defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz <
29 "__builtin_r600_read_local_size">;
30 defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz <
31 "__builtin_r600_read_ngroups">;
32 defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz <
33 "__builtin_r600_read_tgid">;
34 defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz <
35 "__builtin_r600_read_tidig">;
37 def int_r600_rat_store_typed :
38 // 1st parameter: Data
39 // 2nd parameter: Index
40 // 3rd parameter: Constant RAT ID
41 Intrinsic<[], [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty], []>,
42 GCCBuiltin<"__builtin_r600_rat_store_typed">;
44 } // End TargetPrefix = "r600"
46 let TargetPrefix = "AMDGPU" in {
48 class AMDGPUReadPreloadRegisterIntrinsic<string name>
49 : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>,
52 def int_AMDGPU_div_scale : GCCBuiltin<"__builtin_amdgpu_div_scale">,
53 // 1st parameter: Numerator
54 // 2nd parameter: Denominator
55 // 3rd parameter: Constant to select select between first and
56 // second. (0 = first, 1 = second).
57 Intrinsic<[llvm_anyfloat_ty, llvm_i1_ty],
58 [LLVMMatchType<0>, LLVMMatchType<0>, llvm_i1_ty],
61 def int_AMDGPU_div_fmas : GCCBuiltin<"__builtin_amdgpu_div_fmas">,
62 Intrinsic<[llvm_anyfloat_ty],
63 [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>, llvm_i1_ty],
66 def int_AMDGPU_div_fixup : GCCBuiltin<"__builtin_amdgpu_div_fixup">,
67 Intrinsic<[llvm_anyfloat_ty],
68 [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>],
71 def int_AMDGPU_trig_preop : GCCBuiltin<"__builtin_amdgpu_trig_preop">,
72 Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_i32_ty],
75 def int_AMDGPU_rcp : GCCBuiltin<"__builtin_amdgpu_rcp">,
76 Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
78 def int_AMDGPU_rsq : GCCBuiltin<"__builtin_amdgpu_rsq">,
79 Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
81 def int_AMDGPU_rsq_clamped : GCCBuiltin<"__builtin_amdgpu_rsq_clamped">,
82 Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
84 def int_AMDGPU_ldexp : GCCBuiltin<"__builtin_amdgpu_ldexp">,
85 Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, llvm_i32_ty], [IntrNoMem]>;
87 def int_AMDGPU_class : GCCBuiltin<"__builtin_amdgpu_class">,
88 Intrinsic<[llvm_i1_ty], [llvm_anyfloat_ty, llvm_i32_ty], [IntrNoMem]>;
90 def int_AMDGPU_read_workdim : AMDGPUReadPreloadRegisterIntrinsic <
91 "__builtin_amdgpu_read_workdim">;
93 } // End TargetPrefix = "AMDGPU"
95 let TargetPrefix = "amdgcn" in {
98 def int_amdgcn_buffer_wbinvl1_sc :
99 GCCBuiltin<"__builtin_amdgcn_buffer_wbinvl1_sc">,
100 Intrinsic<[], [], []>;
103 def int_amdgcn_buffer_wbinvl1_vol :
104 GCCBuiltin<"__builtin_amdgcn_buffer_wbinvl1_vol">,
105 Intrinsic<[], [], []>;
107 def int_amdgcn_buffer_wbinvl1 :
108 GCCBuiltin<"__builtin_amdgcn_buffer_wbinvl1">,
109 Intrinsic<[], [], []>;
111 def int_amdgcn_s_dcache_inv :
112 GCCBuiltin<"__builtin_amdgcn_s_dcache_inv">,
113 Intrinsic<[], [], []>;
116 def int_amdgcn_s_dcache_inv_vol :
117 GCCBuiltin<"__builtin_amdgcn_s_dcache_inv_vol">,
118 Intrinsic<[], [], []>;
121 def int_amdgcn_s_dcache_wb :
122 GCCBuiltin<"__builtin_amdgcn_s_dcache_wb">,
123 Intrinsic<[], [], []>;
126 def int_amdgcn_s_dcache_wb_vol :
127 GCCBuiltin<"__builtin_amdgcn_s_dcache_wb_vol">,
128 Intrinsic<[], [], []>;