Skip to content

[RISCV] float to int conversion intrinsics are incorrectly enabled with Zvfhmin #101526

Closed
@topperc

Description

@topperc

We have this code in SemaRISCV.cpp to disable f16 intrinsics without Zvfh.

      if (BaseType == BasicType::Float16) {                                      
        if ((Record.RequiredExtensions & RVV_REQ_Zvfhmin) == RVV_REQ_Zvfhmin) {  
          if (!TI.hasFeature("zvfhmin"))                                         
            continue;                                                            
        } else if (!TI.hasFeature("zvfh")) {                                     
          continue;                                                              
        }                                                                        
      } 

For the conversion intrinsics, the BaseType is integer, not floating point, so we miss this check if any of the source operands are Float16.

This causes a crash with Zvfhmin https://godbolt.org/z/Khfx8j6jW

CC: @jacquesguan @kito-cheng @rofirrim

Metadata

Metadata

Assignees

Labels

backend:RISC-Vclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions