"mffscrn %0,%1"
[(set_attr "type" "fp")])
+(define_insn "rs6000_mffscrni"
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec_volatile:DF [(match_operand:SI 1 "const_0_to_3_operand" "n")]
+ UNSPECV_MFFSCRN))]
+ "TARGET_P9_MISC"
+ "mffscrni %0,%1"
+ [(set_attr "type" "fp")])
+
(define_insn "rs6000_mffscdrn"
[(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(unspec_volatile:DF [(const_int 0)] UNSPECV_MFFSCDRN))
[(set_attr "type" "fp")])
(define_expand "rs6000_set_fpscr_rn"
- [(match_operand:DI 0 "reg_or_cint_operand")]
+ [(match_operand:SI 0 "reg_or_cint_operand")]
"TARGET_HARD_FLOAT"
{
rtx tmp_df = gen_reg_rtx (DFmode);
new rounding mode bits from operands[0][62:63] into FPSCR[62:63]. */
if (TARGET_P9_MISC)
{
- rtx src_df = force_reg (DImode, operands[0]);
- src_df = simplify_gen_subreg (DFmode, src_df, DImode, 0);
- emit_insn (gen_rs6000_mffscrn (tmp_df, src_df));
+ if (const_0_to_3_operand (operands[0], VOIDmode))
+ emit_insn (gen_rs6000_mffscrni (tmp_df, operands[0]));
+ else
+ {
+ rtx op0 = convert_to_mode (DImode, operands[0], false);
+ rtx src_df = simplify_gen_subreg (DFmode, op0, DImode, 0);
+ emit_insn (gen_rs6000_mffscrn (tmp_df, src_df));
+ }
DONE;
}
rtx tmp_di = gen_reg_rtx (DImode);
/* Extract new RN mode from operand. */
- emit_insn (gen_anddi3 (tmp_rn, operands[0], GEN_INT (0x3)));
+ rtx op0 = convert_to_mode (DImode, operands[0], false);
+ emit_insn (gen_anddi3 (tmp_rn, op0, GEN_INT (3)));
/* Insert new RN mode into FSCPR. */
emit_insn (gen_rs6000_mffs (tmp_df));
#define RN_MASK 0x3LL /* RN field mask */
void abort (void);
+void __attribute__ ((noipa)) wrap_set_fpscr_rn (int val)
+{
+ __builtin_set_fpscr_rn (val);
+}
int main ()
{
}
/* Test float rounding mode builtin with const value argument. */
- __builtin_set_fpscr_rn(3);
+ val = 3;
+ __builtin_set_fpscr_rn (val);
conv_val.d = __builtin_mffs();
ll_value = conv_val.ll & RN_MASK;
}
val = 2;
- __builtin_set_fpscr_rn(val);
+ __builtin_set_fpscr_rn (val);
conv_val.d = __builtin_mffs();
ll_value = conv_val.ll & RN_MASK;
/* Reset to 0 for testing */
val = 0;
- __builtin_set_fpscr_rn(val);
+ __builtin_set_fpscr_rn (val);
__builtin_mtfsb1(31);
conv_val.d = __builtin_mffs();
/* Test builtin float rounding mode with variable as argument. */
val = 0;
- __builtin_set_fpscr_rn(val);
+ wrap_set_fpscr_rn (val);
conv_val.d = __builtin_mffs();
ll_value = conv_val.ll & RN_MASK;
}
val = 3;
- __builtin_set_fpscr_rn(val);
+ wrap_set_fpscr_rn (val);
conv_val.d = __builtin_mffs();
ll_value = conv_val.ll & RN_MASK;