Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/T-Pau/Accelerate
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Aug 27, 2024
2 parents 83afe98 + 88a8be6 commit d3567c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ jobs:
working-directory: ${{runner.workspace}}/build
run: |
cmake ${{ matrix.cmake_extra }} -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake ${{github.workspace}}
- name: Archive production artifacts
if: ${{ runner.os == 'Windows' }}
uses: actions/upload-artifact@v4
with:
name: build-directory-${{ matrix.os }}-${{ matrix.name_extra }}
path: |
${{runner.workspace}}/build
- name: build
- name: build (Unix)
if: ${{ runner.os != 'Windows' }}
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config Release
- name: build (Windows)
# Generating libraries fails on Windows, so just build the executable for now.
if: ${{ runner.os == 'Windows' }}
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config Release --target xlr8
- name: test
# Tests can't run on Windows until library generation is fixed.
if: ${{ runner.os != 'Windows' }}
working-directory: ${{runner.workspace}}/build
run: |
ctest --output-on-failure --verbose -C Release
2 changes: 0 additions & 2 deletions share/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ else()
set(BIN_SUBDIRECTORY "")
endif()
set(XLR8 "${CMAKE_BINARY_DIR}/src${BIN_SUBDIRECTORY}/xlr8${CMAKE_EXECUTABLE_SUFFIX}")
message(STATUS "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' CMAKE_INSTALL_CONFIG_NAME='${CMAKE_INSTALL_CONFIG_NAME}', CMAKE_GENERATOR='${CMAKE_GENERATOR}', BIN_SUBDIRECTORY='${BIN_SUBDIRECTORY}', XLR8='${XLR8}'")

file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.s)

Expand All @@ -23,7 +22,6 @@ foreach(SOURCE IN LISTS SOURCES)
add_custom_command(
OUTPUT ${LIB}
MAIN_DEPENDENCY ${SOURCE}
#DEPENDS ${XLR8}
DEPENDS xlr8
DEPFILE ${depfile}
COMMAND ${XLR8} --system-directory ${CMAKE_SOURCE_DIR}/share --depfile ${depfile} --create-library -o ${LIB} ${SOURCE}
Expand Down
16 changes: 8 additions & 8 deletions src/BinaryExpression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ Expression BinaryExpression::create(const Location& location, const Expression&
// TODO: check that types are compatible

if (left.has_value() && right.has_value()) {
const auto& left_value = *left.value();
const auto& right_value = *right.value();
auto left_value = *left.value();
auto right_value = *right.value();
Value value;

switch (operation) {
Expand Down Expand Up @@ -212,15 +212,15 @@ Expression BinaryExpression::create(const Location& location, const Expression&
switch (operation) {
case Expression::BinaryOperation::ADD: {
if (right.has_value()) {
const auto& right_value = *right.value();
auto right_value = *right.value();
if (right_value == Value(uint64_t{0})) {
// N + 0 -> N
return left;
}
else if (left.is_binary()) {
const auto& left_binary = left.as_binary();
auto left_binary = left.as_binary();
if (left_binary->right.has_value()) {
const auto& left_right_value = *left_binary->right.value();
auto left_right_value = *left_binary->right.value();
if (left_binary->operation == Expression::ADD) {
// (N + A) + B -> N + (A+B)
return {location, left_binary->left, Expression::ADD, Expression({left_binary->right.location(), right.location()}, left_right_value + right_value)};
Expand All @@ -233,15 +233,15 @@ Expression BinaryExpression::create(const Location& location, const Expression&
}
}
if (left.has_value()) {
const auto& left_value = *left.value();
auto left_value = *left.value();
if (left_value == Value(uint64_t{0})) {
// 0 + N -> N
return right;
}
else if (right.is_binary()) {
const auto& right_binary = right.as_binary();
auto right_binary = right.as_binary();
if (right_binary->left.has_value()) {
const auto& right_left_value = *right_binary->left.value();
auto right_left_value = *right_binary->left.value();
if (right_binary->operation == Expression::ADD) {
// A + (B + N) -> N + (A+B)
return {location, right_binary->right, Expression::ADD, Expression({left.location(), right_binary->left.location()}, left_value + right_left_value)};
Expand Down

0 comments on commit d3567c3

Please sign in to comment.