github.com/apache/arrow/go/v7@v7.0.1/parquet/internal/bmi/Makefile (about)

     1  # Licensed to the Apache Software Foundation (ASF) under one
     2  # or more contributor license agreements.  See the NOTICE file
     3  # distributed with this work for additional information
     4  # regarding copyright ownership.  The ASF licenses this file
     5  # to you under the Apache License, Version 2.0 (the
     6  # "License"); you may not use this file except in compliance
     7  # with the License.  You may obtain a copy of the License at
     8  #
     9  # http://www.apache.org/licenses/LICENSE-2.0
    10  #
    11  # Unless required by applicable law or agreed to in writing, software
    12  # distributed under the License is distributed on an "AS IS" BASIS,
    13  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  # See the License for the specific language governing permissions and
    15  # limitations under the License.
    16  
    17  PERL_FIXUP_ROTATE=perl -i -pe 's/(ro[rl]\s+\w{2,3})$$/\1, 1/'
    18  # since we're passing an int16, swap the MOVQ for the argument to a MOVW as per
    19  # the message given by go vet since it's a 2-byte value.
    20  PERL_FIXUP_MOVQ_MOVW=perl -i -pe 's/MOVQ rhs\+16\(FP\)/MOVW rhs+16(FP)/'
    21  C2GOASM=c2goasm -a -f
    22  CC=clang
    23  C_FLAGS=-masm=intel -mno-red-zone -mstackrealign -mllvm -inline-threshold=1000 \
    24  				-fno-asynchronous-unwind-tables -fno-exceptions -fno-rtti -O3 -fno-builtin -ffast-math -fno-jump-tables -I_lib
    25  ASM_FLAGS_AVX2=-mavx2 -mfma
    26  ASM_FLAGS_BMI2=-mbmi2
    27  ASM_FLAGS_POPCNT=-mpopcnt
    28  
    29  GO_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -not -name '*_test.go')
    30  ALL_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -name '*.s' -not -name '*_test.go')
    31  
    32  INTEL_SOURCES := \
    33  	bitmap_bmi2.s
    34  
    35  .PHONEY: assembly
    36  
    37  assembly: $(INTEL_SOURCES)
    38  
    39  _lib/bitmap_bmi2.s: _lib/bitmap_bmi2.c
    40  	$(CC) -S $(ASM_FLAGS_AVX2) $(ASM_FLAGS_BMI2) $(ASM_FLAGS_POPCNT) $(C_FLAGS)  $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    41  
    42  bitmap_bmi2.s: _lib/bitmap_bmi2.s
    43  	$(C2GOASM) $^ $@ ; $(PERL_FIXUP_MOVQ_MOVW) $@
    44  
    45  clean:
    46  	rm -f $(INTEL_SOURCES)
    47  	rm -f _lib/$(INTEL_SOURCES)