ConstrainedOps.def 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. // DAG_FUNCTION defers to DAG_INSTRUCTION if its defined, otherwise FUNCTION.
  14. #ifndef DAG_FUNCTION
  15. #ifdef DAG_INSTRUCTION
  16. #define DAG_FUNCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D)
  17. #else
  18. #define DAG_FUNCTION(N,A,R,I,D) FUNCTION(N,A,R,I)
  19. #endif
  20. #endif
  21. #ifndef INSTRUCTION
  22. #define INSTRUCTION(N,A,R,I)
  23. #endif
  24. // DAG_INSTRUCTION is treated like an INSTRUCTION if the DAG node isn't used.
  25. #ifndef DAG_INSTRUCTION
  26. #define DAG_INSTRUCTION(N,A,R,I,D) INSTRUCTION(N,A,R,I)
  27. #endif
  28. // In most cases intrinsic function is handled similar to instruction.
  29. #ifndef FUNCTION
  30. #define FUNCTION(N,A,R,I) INSTRUCTION(N,A,R,I)
  31. #endif
  32. // Compare instruction have a DAG node so they are treated like DAG_INSTRUCTION.
  33. #ifndef CMP_INSTRUCTION
  34. #define CMP_INSTRUCTION(N,A,R,I,D) DAG_INSTRUCTION(N,A,R,I,D)
  35. #endif
  36. // Arguments of the entries are:
  37. // - instruction or intrinsic function name.
  38. // - Number of original instruction/intrinsic arguments.
  39. // - 1 if the corresponding constrained intrinsic has rounding mode argument.
  40. // - name of the constrained intrinsic to represent this instruction/function.
  41. // - DAG node corresponding to the constrained intrinsic without prefix STRICT_.
  42. // These are definitions for instructions, that are converted into constrained
  43. // intrinsics.
  44. //
  45. DAG_INSTRUCTION(FAdd, 2, 1, experimental_constrained_fadd, FADD)
  46. DAG_INSTRUCTION(FSub, 2, 1, experimental_constrained_fsub, FSUB)
  47. DAG_INSTRUCTION(FMul, 2, 1, experimental_constrained_fmul, FMUL)
  48. DAG_INSTRUCTION(FDiv, 2, 1, experimental_constrained_fdiv, FDIV)
  49. DAG_INSTRUCTION(FRem, 2, 1, experimental_constrained_frem, FREM)
  50. DAG_INSTRUCTION(FPExt, 1, 0, experimental_constrained_fpext, FP_EXTEND)
  51. DAG_INSTRUCTION(SIToFP, 1, 1, experimental_constrained_sitofp, SINT_TO_FP)
  52. DAG_INSTRUCTION(UIToFP, 1, 1, experimental_constrained_uitofp, UINT_TO_FP)
  53. DAG_INSTRUCTION(FPToSI, 1, 0, experimental_constrained_fptosi, FP_TO_SINT)
  54. DAG_INSTRUCTION(FPToUI, 1, 0, experimental_constrained_fptoui, FP_TO_UINT)
  55. DAG_INSTRUCTION(FPTrunc, 1, 1, experimental_constrained_fptrunc, FP_ROUND)
  56. // These are definitions for compare instructions (signaling and quiet version).
  57. // Both of these match to FCmp / SETCC.
  58. CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmp, FSETCC)
  59. CMP_INSTRUCTION(FCmp, 2, 0, experimental_constrained_fcmps, FSETCCS)
  60. // Theses are definitions for intrinsic functions, that are converted into
  61. // constrained intrinsics.
  62. //
  63. DAG_FUNCTION(ceil, 1, 0, experimental_constrained_ceil, FCEIL)
  64. DAG_FUNCTION(cos, 1, 1, experimental_constrained_cos, FCOS)
  65. DAG_FUNCTION(exp, 1, 1, experimental_constrained_exp, FEXP)
  66. DAG_FUNCTION(exp2, 1, 1, experimental_constrained_exp2, FEXP2)
  67. DAG_FUNCTION(floor, 1, 0, experimental_constrained_floor, FFLOOR)
  68. DAG_FUNCTION(fma, 3, 1, experimental_constrained_fma, FMA)
  69. DAG_FUNCTION(log, 1, 1, experimental_constrained_log, FLOG)
  70. DAG_FUNCTION(log10, 1, 1, experimental_constrained_log10, FLOG10)
  71. DAG_FUNCTION(log2, 1, 1, experimental_constrained_log2, FLOG2)
  72. DAG_FUNCTION(lrint, 1, 1, experimental_constrained_lrint, LRINT)
  73. DAG_FUNCTION(llrint, 1, 1, experimental_constrained_llrint, LLRINT)
  74. DAG_FUNCTION(lround, 1, 0, experimental_constrained_lround, LROUND)
  75. DAG_FUNCTION(llround, 1, 0, experimental_constrained_llround, LLROUND)
  76. DAG_FUNCTION(maxnum, 2, 0, experimental_constrained_maxnum, FMAXNUM)
  77. DAG_FUNCTION(minnum, 2, 0, experimental_constrained_minnum, FMINNUM)
  78. DAG_FUNCTION(maximum, 2, 0, experimental_constrained_maximum, FMAXIMUM)
  79. DAG_FUNCTION(minimum, 2, 0, experimental_constrained_minimum, FMINIMUM)
  80. DAG_FUNCTION(nearbyint, 1, 1, experimental_constrained_nearbyint, FNEARBYINT)
  81. DAG_FUNCTION(pow, 2, 1, experimental_constrained_pow, FPOW)
  82. DAG_FUNCTION(powi, 2, 1, experimental_constrained_powi, FPOWI)
  83. DAG_FUNCTION(rint, 1, 1, experimental_constrained_rint, FRINT)
  84. DAG_FUNCTION(round, 1, 0, experimental_constrained_round, FROUND)
  85. DAG_FUNCTION(roundeven, 1, 0, experimental_constrained_roundeven, FROUNDEVEN)
  86. DAG_FUNCTION(sin, 1, 1, experimental_constrained_sin, FSIN)
  87. DAG_FUNCTION(sqrt, 1, 1, experimental_constrained_sqrt, FSQRT)
  88. DAG_FUNCTION(trunc, 1, 0, experimental_constrained_trunc, FTRUNC)
  89. // This is definition for fmuladd intrinsic function, that is converted into
  90. // constrained FMA or FMUL + FADD intrinsics.
  91. FUNCTION(fmuladd, 3, 1, experimental_constrained_fmuladd)
  92. #undef INSTRUCTION
  93. #undef FUNCTION
  94. #undef CMP_INSTRUCTION
  95. #undef DAG_INSTRUCTION
  96. #undef DAG_FUNCTION