1//===- llvm/IR/ConstrainedOps.def - Constrained intrinsics ------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8// 9// Defines properties of constrained intrinsics, in particular corresponding 10// floating point operations and DAG nodes. 11// 12//===----------------------------------------------------------------------===// 13 14// DAG_FUNCTION defers to DAG_INSTRUCTION if its defined, otherwise FUNCTION. 15#ifndef DAG_FUNCTION 16#ifdef DAG_INSTRUCTION 17#define DAG_FUNCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D) 18#else 19#define DAG_FUNCTION(N,A,R,I,D) FUNCTION(N,A,R,I) 20#endif 21#endif 22 23#ifndef INSTRUCTION 24#define INSTRUCTION(N,A,R,I) 25#endif 26 27// DAG_INSTRUCTION is treated like an INSTRUCTION if the DAG node isn't used. 28#ifndef DAG_INSTRUCTION 29#define DAG_INSTRUCTION(N,A,R,I,D) INSTRUCTION(N,A,R,I) 30#endif 31 32// In most cases intrinsic function is handled similar to instruction. 33#ifndef FUNCTION 34#define FUNCTION(N,A,R,I) INSTRUCTION(N,A,R,I) 35#endif 36 37// Compare instruction have a DAG node so they are treated like DAG_INSTRUCTION. 38#ifndef CMP_INSTRUCTION 39#define CMP_INSTRUCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D) 40#endif 41 42// Arguments of the entries are: 43// - instruction or intrinsic function name. 44// - Number of original instruction/intrinsic arguments. 45// - 1 if the corresponding constrained intrinsic has rounding mode argument. 46// - name of the constrained intrinsic to represent this instruction/function. 47// - DAG node corresponding to the constrained intrinsic without prefix STRICT_. 48 49// These are definitions for instructions, that are converted into constrained 50// intrinsics. 51// 52DAG_INSTRUCTION(FAdd, 2, 1, experimental_constrained_fadd, FADD) 53DAG_INSTRUCTION(FSub, 2, 1, experimental_constrained_fsub, FSUB) 54DAG_INSTRUCTION(FMul, 2, 1, experimental_constrained_fmul, FMUL) 55DAG_INSTRUCTION(FDiv, 2, 1, experimental_constrained_fdiv, FDIV) 56DAG_INSTRUCTION(FRem, 2, 1, experimental_constrained_frem, FREM) 57DAG_INSTRUCTION(FPExt, 1, 0, experimental_constrained_fpext, FP_EXTEND) 58DAG_INSTRUCTION(SIToFP, 1, 1, experimental_constrained_sitofp, SINT_TO_FP) 59DAG_INSTRUCTION(UIToFP, 1, 1, experimental_constrained_uitofp, UINT_TO_FP) 60DAG_INSTRUCTION(FPToSI, 1, 0, experimental_constrained_fptosi, FP_TO_SINT) 61DAG_INSTRUCTION(FPToUI, 1, 0, experimental_constrained_fptoui, FP_TO_UINT) 62DAG_INSTRUCTION(FPTrunc, 1, 1, experimental_constrained_fptrunc, FP_ROUND) 63 64// These are definitions for compare instructions (signaling and quiet version). 65// Both of these match to FCmp / SETCC. 66CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmp, FSETCC) 67CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmps, FSETCCS) 68 69// Theses are definitions for intrinsic functions, that are converted into 70// constrained intrinsics. 71// 72DAG_FUNCTION(acos, 1, 1, experimental_constrained_acos, FACOS) 73DAG_FUNCTION(asin, 1, 1, experimental_constrained_asin, FASIN) 74DAG_FUNCTION(atan, 1, 1, experimental_constrained_atan, FATAN) 75DAG_FUNCTION(ceil, 1, 0, experimental_constrained_ceil, FCEIL) 76DAG_FUNCTION(cos, 1, 1, experimental_constrained_cos, FCOS) 77DAG_FUNCTION(cosh, 1, 1, experimental_constrained_cosh, FCOSH) 78DAG_FUNCTION(exp, 1, 1, experimental_constrained_exp, FEXP) 79DAG_FUNCTION(exp2, 1, 1, experimental_constrained_exp2, FEXP2) 80DAG_FUNCTION(floor, 1, 0, experimental_constrained_floor, FFLOOR) 81DAG_FUNCTION(fma, 3, 1, experimental_constrained_fma, FMA) 82DAG_FUNCTION(log, 1, 1, experimental_constrained_log, FLOG) 83DAG_FUNCTION(log10, 1, 1, experimental_constrained_log10, FLOG10) 84DAG_FUNCTION(log2, 1, 1, experimental_constrained_log2, FLOG2) 85DAG_FUNCTION(lrint, 1, 1, experimental_constrained_lrint, LRINT) 86DAG_FUNCTION(llrint, 1, 1, experimental_constrained_llrint, LLRINT) 87DAG_FUNCTION(lround, 1, 0, experimental_constrained_lround, LROUND) 88DAG_FUNCTION(llround, 1, 0, experimental_constrained_llround, LLROUND) 89DAG_FUNCTION(maxnum, 2, 0, experimental_constrained_maxnum, FMAXNUM) 90DAG_FUNCTION(minnum, 2, 0, experimental_constrained_minnum, FMINNUM) 91DAG_FUNCTION(maximum, 2, 0, experimental_constrained_maximum, FMAXIMUM) 92DAG_FUNCTION(minimum, 2, 0, experimental_constrained_minimum, FMINIMUM) 93DAG_FUNCTION(nearbyint, 1, 1, experimental_constrained_nearbyint, FNEARBYINT) 94DAG_FUNCTION(pow, 2, 1, experimental_constrained_pow, FPOW) 95DAG_FUNCTION(powi, 2, 1, experimental_constrained_powi, FPOWI) 96DAG_FUNCTION(ldexp, 2, 1, experimental_constrained_ldexp, FLDEXP) 97DAG_FUNCTION(rint, 1, 1, experimental_constrained_rint, FRINT) 98DAG_FUNCTION(round, 1, 0, experimental_constrained_round, FROUND) 99DAG_FUNCTION(roundeven, 1, 0, experimental_constrained_roundeven, FROUNDEVEN) 100DAG_FUNCTION(sin, 1, 1, experimental_constrained_sin, FSIN) 101DAG_FUNCTION(sinh, 1, 1, experimental_constrained_sinh, FSINH) 102DAG_FUNCTION(sqrt, 1, 1, experimental_constrained_sqrt, FSQRT) 103DAG_FUNCTION(tan, 1, 1, experimental_constrained_tan, FTAN) 104DAG_FUNCTION(tanh, 1, 1, experimental_constrained_tanh, FTANH) 105DAG_FUNCTION(trunc, 1, 0, experimental_constrained_trunc, FTRUNC) 106 107// This is definition for fmuladd intrinsic function, that is converted into 108// constrained FMA or FMUL + FADD intrinsics. 109FUNCTION(fmuladd, 3, 1, experimental_constrained_fmuladd) 110 111#undef INSTRUCTION 112#undef FUNCTION 113#undef CMP_INSTRUCTION 114#undef DAG_INSTRUCTION 115#undef DAG_FUNCTION 116