// http://llvm.org/docs/LangRef.html#frem-instr
// keywords: arithmetic; binary; instr

.type FRemInstruction <: symbol
.decl frem_instr(instr:FRemInstruction)

instr(v) :- frem_instr(v).

.decl frem_instr_first_operand(instr:FRemInstruction, op:Operand)
.decl frem_instr_second_operand(instr:FRemInstruction, op:Operand)


//-------------------------------------------------------------------
// [Constraints]
//
// 1) The two arguments to the ‘frem‘ instr must be:
//      (i)  floating point or
//      (ii) vector of floating point values.
//
// 2) Both arguments must have identical types.
//
// 3) The resulting value is the same type as its operands.
//-------------------------------------------------------------------

schema_invalid_instr(Instr, __FILE__, __LINE__) :-
   schema_sanity(),
   frem_instr(Instr),
   !frem_instr_first_operand(Instr, _).

schema_invalid_instr(Instr, __FILE__, __LINE__) :-
   schema_sanity(),
   frem_instr(Instr),
   !frem_instr_second_operand(Instr, _).

schema_invalid_instr(Instr, __FILE__, __LINE__) :-
   schema_sanity(),
   frem_instr(Instr),
   instr_returns_type(Instr, Type),
   !fp_type(Type),
   !fp_vector_type(Type).

schema_invalid_instr(Instr, __FILE__, __LINE__) :-
   schema_sanity(),
   instr_returns_type(Instr, Type),
   frem_instr_first_operand(Instr, LeftOp),
   !operand_has_type(LeftOp, Type).

schema_invalid_instr(Instr, __FILE__, __LINE__) :-
   schema_sanity(),
   instr_returns_type(Instr, Type),
   frem_instr_second_operand(Instr, RightOp),
   !operand_has_type(RightOp, Type).
