github.com/apache/arrow/go/v7@v7.0.1/parquet/internal/utils/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  # this converts rotate instructions from "ro[lr] <reg>" -> "ro[lr] <reg>, 1" for yasm compatibility
    18  PERL_FIXUP_ROTATE=perl -i -pe 's/(ro[rl]\s+\w{2,3})$$/\1, 1/'
    19  
    20  C2GOASM=c2goasm
    21  CC=clang-11
    22  C_FLAGS=-target x86_64-unknown-none -masm=intel -mno-red-zone -mstackrealign -mllvm -inline-threshold=1000 \
    23  				-fno-asynchronous-unwind-tables -fno-exceptions -fno-rtti -O3 -fno-builtin -ffast-math -fno-jump-tables -I_lib
    24  ASM_FLAGS_AVX2=-mavx2 -mfma
    25  ASM_FLAGS_SSE4=-msse4
    26  ASM_FLAGS_BMI2=-mbmi2
    27  ASM_FLAGS_POPCNT=-mpopcnt
    28  
    29  C_FLAGS_NEON=-O3 -fvectorize -mllvm -force-vector-width=16 -fno-asynchronous-unwind-tables -mno-red-zone -mstackrealign -fno-exceptions \
    30  	-fno-rtti -fno-builtin -ffast-math -fno-jump-tables -I_lib
    31  
    32  GO_SOURCES  := $(shell find . -path ./_lib -prune -o -name '*.go' -not -name '*_test.go')
    33  ALL_SOURCES := $(shell find . -path ./_lib -prune -o -name '*.go' -name '*.s' -not -name '*_test.go')
    34  
    35  .PHONEY: assembly
    36  
    37  INTEL_SOURCES := \
    38  	bit_packing_avx2.s min_max_avx2.s min_max_sse4.s \
    39  	unpack_bool_avx2.s unpack_bool_sse4.s
    40  
    41  #
    42  # ARROW-15336: DO NOT add the assembly target for Arm64 (ARM_SOURCES) until c2goasm added the Arm64 support.
    43  # min_max_neon_arm64.s was generated by asm2plan9s.
    44  # And manually formatted it as the Arm64 Plan9.
    45  #
    46  
    47  assembly: $(INTEL_SOURCES)
    48  
    49  _lib/bit_packing_avx2.s: _lib/bit_packing_avx2.c
    50  	$(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@; perl -i -pe 's/mem(cpy|set)/clib·_mem\1(SB)/' $@
    51  
    52  _lib/min_max_avx2.s: _lib/min_max.c
    53  	$(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    54  
    55  _lib/min_max_sse4.s: _lib/min_max.c
    56  	$(CC) -S $(C_FLAGS) $(ASM_FLAGS_SSE4) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    57  
    58  _lib/min_max_neon.s: _lib/min_max.c
    59  	$(CC) -S $(C_FLAGS_NEON) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    60  
    61  _lib/unpack_bool_avx2.s: _lib/unpack_bool.c
    62  	$(CC) -S $(C_FLAGS) $(ASM_FLAGS_AVX2) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    63  
    64  _lib/unpack_bool_sse4.s: _lib/unpack_bool.c
    65  	$(CC) -S $(C_FLAGS) $(ASM_FLAGS_SSE4) $^ -o $@ ; $(PERL_FIXUP_ROTATE) $@
    66  
    67  bit_packing_avx2.s: _lib/bit_packing_avx2.s
    68  	$(C2GOASM) -a -f $^ $@
    69  
    70  min_max_avx2.s: _lib/min_max_avx2.s
    71  	$(C2GOASM) -a -f $^ $@
    72  
    73  min_max_sse4.s: _lib/min_max_sse4.s
    74  	$(C2GOASM) -a -f $^ $@
    75  
    76  unpack_bool_avx2.s: _lib/unpack_bool_avx2.s
    77  	$(C2GOASM) -a -f $^ $@
    78  
    79  unpack_bool_sse4.s: _lib/unpack_bool_sse4.s
    80  	$(C2GOASM) -a -f $^ $@
    81  
    82  clean:
    83  	rm -f $(INTEL_SOURCES)
    84  	rm -f $(addprefix _lib/,$(INTEL_SOURCES))