Skip to content

Commit

Permalink
volatile input
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Dec 31, 2024
1 parent e2c5cec commit cea3826
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions numerics/sin_cos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,27 @@
#if PRINCIPIA_USE_OSACA_SIN || PRINCIPIA_USE_OSACA_COS
#include "intel/iacaMarks.h"
static bool OSACA_loop_terminator = false;
#define OSACA_FUNCTION_BEGIN(arg) \
double OSACA_loop_carry = arg; \
IACA_VC64_START; \
OSACA_LOOP: \
#define OSACA_FUNCTION_BEGIN(arg) \
double volatile OSACA_input = arg; \
/* Putting a load of the input from memory in the analysed section makes the \
* dependency graph clearer, but adds a potentially spurious move to the \
* loop-carried latency. Remove the `volatile` above to carry the loop \
* through registers.*/ \
IACA_VC64_START; \
double OSACA_loop_carry = OSACA_input; \
OSACA_LOOP: \
arg = OSACA_loop_carry

#define OSACA_RETURN(result) \
OSACA_loop_carry = (result); \
if (!OSACA_loop_terminator) { \
goto OSACA_LOOP; \
} \
volatile double OSACA_result = OSACA_loop_carry; \
double volatile OSACA_result = OSACA_loop_carry; \
IACA_VC64_END; \
return OSACA_result
#define OSACA_IF(condition) \
if constexpr (volatile bool OSACA_computed_condition = (condition); \
if constexpr (bool volatile OSACA_computed_condition = (condition); \
[] { UNDER_OSACA_HYPOTHESES(return (condition)); }())

#define UNDER_OSACA_HYPOTHESES(statement) \
Expand Down

0 comments on commit cea3826

Please sign in to comment.