[PATCH] D127871: [RISCV] Optimize 2x SELECT for floating-point types

Diego Caballero via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 15:29:27 PDT 2022


dcaballe added a comment.

I was able to reduce the test case to:

  target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"                                                                                                                                
  target triple = "riscv64-unknown-unknown-eabi-elf"                                                                                                                                          
                                                                                                                                                                                              
  ; Function Attrs: nofree nosync nounwind                                                                                                                                                    
  define internal i32 @main_dispatch_72(i8* %i5, <2 x float> %i44, <2 x float> %i61, <2 x i32> %i65) {                                                                                        
  bbi:                                                                                                                                                                                        
    %i45 = fcmp uno <2 x float> %i44, zeroinitializer                                                                                                                                         
    %i62 = fcmp oeq <2 x float> %i44, <float 0xFFF0000000000000, float 0xFFF0000000000000>                                                                                                    
    %i63 = fcmp oeq <2 x float> %i44, <float 0x7FF0000000000000, float 0x7FF0000000000000>                                                                                                    
    %i64 = fcmp ogt <2 x float> %i44, zeroinitializer                                                                                                                                         
    %i66 = icmp ult <2 x i32> %i65, <i32 255, i32 255>                                                                                                                                        
    %i67 = select <2 x i1> %i64, <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>, <2 x float> <float 0x3810000000000000, float 0x3810000000000000>                           
    %i68 = select <2 x i1> %i66, <2 x float> %i61, <2 x float> %i67                                                                                                                           
    %i69 = select <2 x i1> %i63, <2 x float> <float 0x7FF0000000000000, float 0x7FF0000000000000>, <2 x float> %i68                                                                           
    %i70 = select <2 x i1> %i62, <2 x float> zeroinitializer, <2 x float> %i69                                                                                                                
    %i71 = select <2 x i1> %i45, <2 x float> %i44, <2 x float> %i70                                                                                                                           
    %i72 = bitcast i8* %i5 to <2 x float>*                                                                                                                                                    
    store <2 x float> %i71, <2 x float>* %i72, align 64                                                                                                                                       
    ret i32 0                                                                                                                                                                                 
  }  

Your code should trigger with `llc bug.ll -mcpu=generic-rv64 -mattr=+m,+a,+f,+d,+c -target-abi=lp64d`.

It looks like it's a case where your transformation is applied multiple times on the output produced by previous instances.

I'll revert this commit while this is being investigated.

Thanks,
Diego


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127871/new/

https://reviews.llvm.org/D127871



More information about the llvm-commits mailing list