#include #include "../common.h" #include #include TEST_CASE("RWControl") { constexpr pfor::expr::Access R = pfor::expr::Access::read, W = pfor::expr::Access::write; pfor::Index it; using OT1R = pfor::expr::OperandTag; using OT2R = pfor::expr::OperandTag; using OT3R = pfor::expr::OperandTag; using OT1W = pfor::expr::OperandTag; using OT2W = pfor::expr::OperandTag; using OT3W = pfor::expr::OperandTag; using Tags1R = pfor::Pack; using Tags1R2R = pfor::Pack; using Tags1R2R3R = pfor::Pack; using Tags1W2R = pfor::Pack; using Tags1W1R2R = pfor::Pack; using Tags1W1R2R3R = pfor::Pack; using Tags1W2W3R3R = pfor::Pack; using Tags1R2W3W3R = pfor::Pack; using Tags1R2W3R3R = pfor::Pack; SECTION("RWControl") { SECTION("Constant index") { using C0 = decltype(pfor::ctv<0>); using TagsW = pfor::Pack>; using TagsR = pfor::Pack>; using TagsRW = pfor::Pack, pfor::expr::OperandTag>; REQUIRE_FALSE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE_FALSE(pfor::rwControl); } SECTION("Same index") { REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE(pfor::rwControl); } SECTION("Different indices") { using OT1RI = pfor::expr::OperandTag*it)>; using OT2RI = pfor::expr::OperandTag*it)>; using OT3RI = pfor::expr::OperandTag*it)>; using OT1WI = pfor::expr::OperandTag*it+pfor::ctv<1>)>; using OT2WI = pfor::expr::OperandTag*it+pfor::ctv<1>)>; using OT3WI = pfor::expr::OperandTag*it+pfor::ctv<1>)>; using Tags1 = pfor::Pack; using Tags2 = pfor::Pack; using Tags3 = pfor::Pack; using Tags4 = pfor::Pack; REQUIRE(pfor::rwControl); REQUIRE_FALSE(pfor::rwControl); REQUIRE_FALSE(pfor::rwControl); REQUIRE(pfor::rwControl); } SECTION("Linear Diophantine Cases") { using LD0 = decltype(pfor::ctv<2>*it); using LD1 = decltype(it+pfor::ctv<5>); using LD2 = decltype(pfor::ctv<2>*it+pfor::ctv<5>); using Tags0 = pfor::Pack, pfor::expr::OperandTag>; using Tags1 = pfor::Pack, pfor::expr::OperandTag>; using Tags2 = pfor::Pack, pfor::expr::OperandTag>; REQUIRE_FALSE(pfor::rwControl); REQUIRE(pfor::rwControl); REQUIRE_FALSE(pfor::rwControl); } } }